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
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"crypto/sha256" | |
"encoding/base64" | |
"fmt" | |
"io" |
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
/*! | |
* Node.js script to encrypt and decrypt an arbitrary string using | |
* 128-bit AES method in CFB mode. | |
* | |
*/ | |
// A 16-byte key is required for a 128-bit encryption | |
var crypto = require('crypto'), | |
key = new Buffer('sixteen byte key'), | |
iv = crypto.randomBytes(16), |