Skip to content

Instantly share code, notes, and snippets.

@russelyang
Created September 8, 2014 14:19
Show Gist options
  • Save russelyang/afc4bb49a581727959e2 to your computer and use it in GitHub Desktop.
Save russelyang/afc4bb49a581727959e2 to your computer and use it in GitHub Desktop.
var vigenere = function() {
function pos(s) {
return s.toLowerCase().charCodeAt(0) - "a".charCodeAt(0);
};
function encryptOneChar(c, key) {
var src = "abcdefghijklmnopqrstuvwxyz",
cipher = {};
for(var i=0; i<src.length; i++) {
cipher[src[i]] = src[(i+key) % 26];
}
return cipher[c];
}
return {
encrypt : function(message, cipher) {
},
decrypt : function(message, cipher) {
}
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment