Skip to content

Instantly share code, notes, and snippets.

@loufq
Created May 12, 2014 05:14
Show Gist options
  • Save loufq/db356d4d6adeb1c2755a to your computer and use it in GitHub Desktop.
Save loufq/db356d4d6adeb1c2755a to your computer and use it in GitHub Desktop.
temp
var crypto = require('crypto');
var cipher = crypto.createCipher('aes256', 'passphrase');
var encrypted = cipher.update("test", 'utf8', 'base64') + cipher.final('base64');
console.log(encrypted);
var decipher = crypto.createDecipher('aes256', 'passphrase');
var plain = decipher.update(encrypted, 'base64', 'utf8') + decipher.final('utf8');
console.log(plain);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment