Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JavaScript-Packer/7b63367208c8b2bcad5a to your computer and use it in GitHub Desktop.

Select an option

Save JavaScript-Packer/7b63367208c8b2bcad5a to your computer and use it in GitHub Desktop.
Simply replaces each character from one array with another character from another array!
<!DOCTYPE html>
<html>
<head>
<title>Encraption &#38; Decraption Algorithm</title>
</head>
<body>
<h1>Encrapted:</h1>
<div id="Silly"></div>
<h1>Unencrapted:</h1>
<div id="not_Silly"></div><script>
/* Simplest "Encryption" and "Decryption" Possible In JavaScript by www.ScriptCompress.com */
/* Simply replaces each character from one array with another character from another array! */
/* Make sure each H & K are the same length of characters */
/* Do not use encoding characters that are already used in your text to be encoded */
var W, H, A, K;
W = "Visit www.WHAK.com";
// below is our characters to target
K = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");
// below is list to replace characters targeted
H = "ÀÆÇËÌÍÎÏÐÑÖרÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČ".split("");
// below is the simplest function possible to do the replacements (curly brackets aren't needed)
for (A in K) {W = W.split(K[A]).join(H[A]);}
// this writes to our <div> tag
document.getElementById("Silly").innerHTML=W;
// now we simply switch variable names of the 2 arrays (K&H) and run again to get a decoder
W = document.getElementById("Silly").innerHTML;
K = "ÀÆÇËÌÍÎÏÐÑÖרÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČ".split("");
H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");
for (A in K)
W = W.split(K[A]).join(H[A]);
document.getElementById("not_Silly").innerHTML=W
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment