Skip to content

Instantly share code, notes, and snippets.

View pythonl1's full-sized avatar
🏠
Working from home

Bhartendu pythonl1

🏠
Working from home
View GitHub Profile
@pythonl1
pythonl1 / encrypt_decrypt.js
Last active October 20, 2016 07:44 — forked from erans/encrypt_decrypt_example.js
Example of encryption and decryption in node.js
var crypto = require("crypto")
function encrypt(key, data) {
var cipher = crypto.createCipher('aes-256-cbc', key);
var crypted = cipher.update(text, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
function decrypt(key, data) {
var decipher = crypto.createDecipher('aes-256-cbc', key);