Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created January 15, 2016 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavaScript-Packer/1f4f9dc788850f9811be to your computer and use it in GitHub Desktop.
Save JavaScript-Packer/1f4f9dc788850f9811be to your computer and use it in GitHub Desktop.
Like ROT13 but uses characters used in JavaScript source codes to encrypt/encode. Function will automatically decide if it must decode or encode. www.whak.ca
function cypher(r) {
function t(r, e) {
var a = "\n\x20\t`~_^*'\"<+,-.:;=>!?/{|}[\\]#$%&()@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
a.length > e && (r === a.split("").reverse().join("")[e] && (n += a[e]), t(r, e + 1));
}
function e(r, a) {
return a > r.length ? void 0 : (t(r[a], 0), e(r, a + 1), n);
}
var n = "";
return e(r, 0);
}
var name = cypher('<script> var theAnswer = "WHAK", Is42 = ".com"; window[\'alert\'](theAnswer+ Is42); <\/script>');
var token = cypher(name);
console.log(name+" => "+token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment