Created
October 4, 2017 21:35
-
-
Save DrPaulBrewer/a9135403122c0d0095cf0853e9b2d23e to your computer and use it in GitHub Desktop.
create random AES-256 key in hex -- compatible with Google Cloud Storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2017 Paul Brewer, Economic and Financial Technology Consulting LLC <[email protected]> | |
// License: The MIT License. See: https://opensource.org/licenses/MIT | |
// Google has an example using base64; hex is a little safer to copy/paste and recognize as incorect | |
// see https://cloud.google.com/storage/docs/using-encryption-keys | |
const crypto = require('crypto'); | |
console.log("hex AES-256 random key follows"); | |
const key = crypto.randomBytes(32); | |
console.log(key.toString('hex')); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment