Created
February 25, 2015 23:18
-
-
Save dervondenbergen/85e150c5fcba6c8bcc58 to your computer and use it in GitHub Desktop.
smaller cipher
This file contains hidden or 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
i=prompt('Please write the text to cipher:'); | |
s=prompt('Steps to shift:'); | |
t=''; | |
var a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
for (var l = 0; l < i.length; l++) { | |
n = a.indexOf(i[l].toUpperCase()) | |
f=100 | |
if (n>-1) | |
f=n+Math.floor(s) | |
if (f > 25) | |
f = f-26; | |
t += a[f] || i[l] | |
} | |
alert(t); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment