Encryption / Decryption in Javascript

Introduction: As as web Developer some times you need encryption and Decryption in Java Script. for this purpose a quick code snap is given below. Solution: Java Script Encryption Function: function Encrypt(PlainText, Key) { var to_enc = PlainText.toString().replace(/^\n+/, "" ).replace(/\n+$/, "" ); var xor_key = Key; var the_res = "" ; for (i = 0; i < to_enc.length; ++i) { if (to_enc.charCodeAt(i) <= 32) { the_res += String.fromCharCode((to_enc.charCodeAt(i))); ...