Skip to content

Instantly share code, notes, and snippets.

@Syrup-tan
Created August 10, 2015 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Syrup-tan/a8abc620f032c1630d1b to your computer and use it in GitHub Desktop.
Save Syrup-tan/a8abc620f032c1630d1b to your computer and use it in GitHub Desktop.
caesar(atob('TFdWIFFSVyBEUSBEVlZEVlZMUSwgTFdWIEQgUUxRTUQ7IFFSVyBZRFBTTFVILVJRSCwgV0tSWEpLLg=='), 23);
function caesar(s, n) {
n = n || 13;
var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return s.toUpperCase().replace(/./g, function(l) {
var index = alphabet.indexOf(l);
return index < 0 ? l : alphabet[(index + n) % 26];
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment