Skip to content

Instantly share code, notes, and snippets.

@intech
Created October 5, 2013 09:25
Show Gist options
  • Save intech/6838746 to your computer and use it in GitHub Desktop.
Save intech/6838746 to your computer and use it in GitHub Desktop.
AES256
// 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