Skip to content

Instantly share code, notes, and snippets.

@gramirezcarrero
Created August 23, 2013 21: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 gramirezcarrero/6323971 to your computer and use it in GitHub Desktop.
Save gramirezcarrero/6323971 to your computer and use it in GitHub Desktop.
A Pen by geronimo.

Crittografia

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.

A Pen by geronimo on CodePen.

License.

<div id="data"></div>
for edit this mensaje edit var node in the script
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;
#data{
color : black;
font-size:15px;
font-family:helvetica;
border: solid 1px black;
width: 220px;
padding:10px;
}body{
font-size:12px;
font-family:helvetica;
}
@gramirezcarrero
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment