Skip to content

Instantly share code, notes, and snippets.

@Paturages
Last active June 27, 2017 23:24
Show Gist options
  • Save Paturages/6da07a24f5733c06bba88bbed586bb10 to your computer and use it in GitHub Desktop.
Save Paturages/6da07a24f5733c06bba88bbed586bb10 to your computer and use it in GitHub Desktop.
JavaScript ROT13 (code golf)
// 105 chars: Common characters only
m=>String.fromCharCode(...[].map.call(m,x=>x.charCodeAt()).map(x=>x<65?x:x<110?x<78|x>95?x+13:x-13:x-13))
// 123 chars: Full character support
m=>String.fromCharCode(...[].map.call(m,x=>x.charCodeAt()).map(x=>x<65|x>122|(x>90&x<97)?x:x<110?x<78|x>95?x+13:x-13:x-13))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment