Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Caesar Cipher packed
// 149 chars :<
/*
function c(o) {
function t(o, s) {
return s.replace(/./g, function(c) {
return String.fromCharCode(c.charCodeAt(0) + o)
})
}
return {
e: t.bind(c, o),
d: t.bind(c, -o)
}
}
*/
function c(o){function t(o,s){return s.replace(/./g,function(c){return String.fromCharCode(c.charCodeAt(0)+o)})}return{e:t.bind(c,o),d:t.bind(c,-o)}}
var caesarCipher = c(3);
caesarCipher.e('Hello world'); // "Khoor#zruog"
caesarCipher.d('Khoor#zruog'); // "Hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment