Created
          November 22, 2011 12:42 
        
      - 
      
 - 
        
Save vstarck/1385585 to your computer and use it in GitHub Desktop.  
    Caesar Cipher packed
  
        
  
    
      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
    
  
  
    
  | // 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