Created
May 14, 2015 08:26
-
-
Save xgeek-net/0348b25a4e6d1e903352 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var crypto = require("crypto"); | |
| var uncipheredText = 'password123'; | |
| var secretkey ='your_secret_key'; | |
| // Encrypte | |
| var cipher = crypto.createCipher('aes192', secretkey); | |
| cipher.update(uncipheredText); | |
| var cipheredText = cipher.final('base64'); | |
| console.log('Encrypted String :' + cipheredText); | |
| // Decrypte | |
| var decipher = crypto.createDecipher('aes192', secretkey); | |
| decipher.update(cipheredText); | |
| var data = decipher.final('utf8'); | |
| console.log('Decrypted String :' + data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment