Created
August 30, 2011 16:06
-
Star
(106)
You must be signed in to star a gist -
Fork
(19)
You must be signed in to fork a gist
Revisions
-
Christian Sanz revised this gist
Aug 30, 2011 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,5 @@ var hw = encrypt("hello world") decrypt(hw) // feel free to change >> d6F3Efeq // To test just copy + paste the above inside the node shell // TIP: always encrypt IDs before sending via HTTP -
Christian Sanz revised this gist
Aug 30, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,4 @@ var hw = encrypt("hello world") decrypt(hw) // feel free to change >> d6F3Efeq // To test just copy + paste the above inside the node shell -
Christian Sanz revised this gist
Aug 30, 2011 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,4 +15,5 @@ function decrypt(text){ var hw = encrypt("hello world") decrypt(hw) // feel free to change >> d6F3Efeq // Just copy + paste the above inside the node shell -
Christian Sanz created this gist
Aug 30, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ function encrypt(text){ var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq') var crypted = cipher.update(text,'utf8','hex') crypted += cipher.final('hex'); return crypted; } function decrypt(text){ var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq') var dec = decipher.update(text,'hex','utf8') dec += decipher.final('utf8'); return dec; } var hw = encrypt("hello world") decrypt(hw) // feel free to change >> d6F3Efeq