Created
October 5, 2013 09:25
-
-
Save intech/6838746 to your computer and use it in GitHub Desktop.
AES256
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
// RC4 PRIVATE KEY | |
var key = '123456789'; | |
var file = 'test123456'; | |
// Encrypt | |
var crypto = require('crypto'); | |
var cipher = crypto.createCipher('aes-256-cbc', key); | |
var encfile = cipher.update(file, 'utf8', 'hex'); | |
encfile += cipher.final('hex'); | |
console.log(encfile); | |
// Decrypt | |
var decipher = crypto.createDecipher('aes-256-cbc', key); | |
var decfile = decipher.update(encfile, 'hex', 'utf8'); | |
decfile += decipher.final('utf8'); | |
console.log(decfile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment