JavaScript Substitution Cypher


   Simple JavaScript Substitution Cipher  


   A Substitution Cipher is an Encryption method in which units of the plaintext (generally single letters or pairs of letters of ordinary text) are replaced with other symbols or groups of symbols creating cipher text.

<!DOCTYPE html>
<html>
    <head>
        <title>Substitution Cipher</title>
    </head>
    <body bgcolor="green">
    <center><p style="font-size:35px"><strong>Substitution Cipher</p></strong><br><br>
        Place your text to Encrypt here:<br><br>
            <input type="text" id="data" name="data"><br><br>
        <p id="a"></p>
        <button onclick="myFunction()">Encrypt</button>

<script>  

function myFunction() {
        var y = document.getElementById("data").value;

a="abcdefghijklmnopqrstuvwxyz";
b="йцфщзлждюбичяњљжæøñпьџoћвच";
c=new Array();

for
(i=0; i<26; i++){ c[a.charAt(i)]=b.charAt(i); c[a.charAt(i).toUpperCase()]=b.charAt(i).toUpperCase();} a="";

 for
(i=0;i<data.value.length;i++){b=data.value.charAt(i);
a+=(b>='A' && b<='Z' || b>='a' && b<='z' ? c[b] : b);}
                document.getElementById("a").innerHTML = (a); }

</script>

    </body>
</html>



More Free Code Examples:


Angular Click Counter



Comments

Popular posts from this blog

Multi-tap Keypad Text Entry

Crypto Mining