Skip to content

Instantly share code, notes, and snippets.

@OrDuan
Last active May 20, 2021 17:00
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 OrDuan/8edd0dd3b0455aa13af1685eb6c6f671 to your computer and use it in GitHub Desktop.
Save OrDuan/8edd0dd3b0455aa13af1685eb6c6f671 to your computer and use it in GitHub Desktop.
function encryptOrDecrypt(txt, pass) {
var ord = [];var buf = "";
for (z = 1; z <= 255; z++) {ord[String.fromCharCode(z)] = z}
for (j = z = 0; z < txt.length; z++) {
buf += String.fromCharCode(ord[txt.substr(z, 1)] ^ ord[pass.substr(j, 1)])
j = (j < pass.length) ? j + 1 : 0
}
return buf
}
let hiddenMessage = "\u0005\u001d\u000b\b7O7\u0010c!\n\u001d\u001abNED!s^_Xc!\u0001\u001dtb\f\u0002\u001c&UD\\4vXX_p";
let password = "******";
console.log(encryptOrDecrypt(hiddenMessage, password))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment