Created
September 5, 2014 05:37
-
-
Save russelyang/a25f7a120d59b2f55dbb to your computer and use it in GitHub Desktop.
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
var decrypt = function(text, key) { | |
var src = "abcdefghijklmnopqrstuvwxyz"; | |
var cipher = {}; | |
for(var i=0 ; i<26; i++) { | |
cipher[src[(i+key) % 26]] = src[i]; | |
} | |
//console.log(cipher); | |
var output = []; | |
for(var j=0; j < text.length; j++) { | |
output[j] = cipher[text[j]]; | |
} | |
return output.join(''); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment