La sostituzione deve soddisfare una relazione di tipo numerico. Le prime nove lettere dell'alfabeto sono sostituite in modo tale che la somma della lettera da sostituire e della lettera sostituente risulti uguale a 10. Per le seguenti 9 lettere dell'alfabeto deve valere una regola simile con somma pari a 28. Per ultime 8 lettere dell'alfabeto la regola è la stessa, con somma pari a 45.
Created
August 23, 2013 21:00
-
-
Save gramirezcarrero/6323971 to your computer and use it in GitHub Desktop.
A Pen by geronimo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="data"></div> | |
for edit this mensaje edit var node in the script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function atbah(clair){ | |
alphabet1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
alphabet2 = 'IHGFNDCBARQPOEMLKJZYXWVUTS'; | |
chiffre = ""; | |
clair = clair.toUpperCase(); | |
k = clair.length; | |
n = 0; | |
for(var count = 0; count < k; count++){ | |
alpha = clair.charAt(count); | |
idx = alphabet1.indexOf(alpha); | |
if (idx > -1) // ne (dé)chiffre que les 26 lettres majuscules | |
{ | |
//if ((n%5==0) && (n>0) && chiffrer) {chiffre.value+=" "}; | |
n++; | |
chiffre += alphabet2.charAt(idx); | |
} | |
if (idx <= -1) | |
{ | |
chiffre +=alpha; | |
n++; | |
} | |
} | |
return chiffre; | |
} | |
var node = atbah("cryptography is very boar"); | |
var div = document.getElementById("data"); | |
//alert(div) | |
div.innerHTML = div.innerHTML +node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#data{ | |
color : black; | |
font-size:15px; | |
font-family:helvetica; | |
border: solid 1px black; | |
width: 220px; | |
padding:10px; | |
}body{ | |
font-size:12px; | |
font-family:helvetica; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://utenti.quipo.it/base5/combinatoria/crittografia2.htm