I am using localStorage in the application.
I use the XOR bit-shift operation to mask the data before it enters the repository.
Here is the masking function:
encrypt: function (str) { var encoded = []; if (!App.crypto.key) { App.crypto.init(); } for (var i = 0, len = str.length; i < len; i++) { var a = str.charCodeAt(i); var b = a ^ App.crypto.key.charCodeAt(App.crypto.key % i); encoded.push(String.fromCharCode(b)); } return encoded.join(""); }
The key value that I use in this case is "MWZ2cyt2N3JwejhxUjA2V3ptRmwxcmVvU09IbFhORHdOcDRiWGh5SGRZMFU4Ym9VY1Y1WXU5c2d6OXhBdU9wTSt1MlpqQXOV
When I mask "[]" in IE9, I get some monster characters. When I try to install this on localStorage, this results in an invalid argument error. Does anyone know what is going on?
source share