Reputation: 454
eval("Encryption={Load:function(enc){var id=enc.split('/z');var e=[id[0],id[2]];id=toNumber(string.reverse(id[1]));enc=e.join('');e=enc.substring(1).split('/');var fin='';console.log(id);for(var CN=0;CN<e.length;CN++){fin+=string.char(toNumber(e[CN])/id);}eval(fin);}};");
It's all on one line because adding new lines into the string (even if I just put \n), causes another error.
When I run this, I get the error, "Uncaught SyntaxError: Unexpected token ILLEGAL"
I can't understand why. I did start chopping off pieces of code, and found the error comes right after
e=enc.substring(1).split('/');
is added.
So if I remove everything in Encryption's Load function including that, it will work. Though I need all of the function.
And I did Google it, and nothing seemed to fit what I was looking for.
Upvotes: 2
Views: 3350
Reputation: 1038770
You had an invalid character in the initial code you posted which you have fixed in your edit:
This works fine:
eval("Encryption={Load:function(enc){var id=enc.split('/z');var e=[id[0],id[2]];id=toNumber(string.reverse(id[1]));enc=e.join('');e=enc.substring(1).split('/');var fin='';console.log(id);for(var CN=0;CN<e.length;CN++){fin+=string.char(toNumber(e[CN])/id);}eval(fin);}};");
as it can be seen from this this jsfiddle
.
Upvotes: 4