Created
May 14, 2015 08:28
-
-
Save xgeek-net/e68ff67e4681a2d2c8a6 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'; | |
| var cipher = crypto.createCipheriv('rc4', secretkey , ''); | |
| var crypt = cipher.update(uncipheredText, 'utf8', 'base64'); | |
| crypt += cipher.final('base64'); | |
| console.log('Encrypted String :' + crypt ); | |
| var decipher = crypto.createDecipheriv('rc4',secretkey , ''); | |
| var data = decipher.update(crypt, 'base64', 'utf8'); | |
| 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