Skip to content

Instantly share code, notes, and snippets.

@DawnImpulse
Last active January 5, 2019 10:40
Show Gist options
  • Save DawnImpulse/811341747c4b1940c5a4b4668d0369de to your computer and use it in GitHub Desktop.
Save DawnImpulse/811341747c4b1940c5a4b4668d0369de to your computer and use it in GitHub Desktop.
AES Encrypt / Decrypt
const crypto = require('crypto');
// function to decryt data..............
var decryptInformation = function(KEY,encryptedText){
const decipher = crypto.createDecipher('aes192', KEY)
var decrypted = decipher.update(text,'hex','utf8')
decrypted += decipher.final('utf8');
return decrypted;
}
const crypto = require('crypto');
// function to encrypt data ....
var encryptInformation= function(KEY,normalText){
const cipher = crypto.createCipher('aes192', KEY);
var encrypted = cipher.update(text,'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment