Created
September 29, 2012 15:51
-
-
Save brianteachman/3804427 to your computer and use it in GitHub Desktop.
ROT-13 letter substitution cipher. For obfuscation because of virtually absent, level of security.
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
//http://en.wikipedia.org/wiki/Rot13 | |
//var name = "Brian Teachman"; | |
//var token = "Oevna Grnpuzna"; | |
function rot13(name) { | |
var lt1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; | |
var lt2 = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm "; | |
var result = ""; | |
for (var char=0; char<name.length; char++) { | |
for (var i=0; i<lt1.length; i++) { | |
if (name[char] === lt1[i]) { | |
result += lt2[i]; | |
} | |
} | |
} | |
return result; | |
} | |
//result = rot13("name"); | |
anzr = rot13("Brian Teachman"); | |
console.log(anzr); // Oevna Grnpuzna |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment