Skip to content

Instantly share code, notes, and snippets.

@4hg
Last active July 30, 2021 05:54
Show Gist options
  • Save 4hg/b0a271f5e720f7b41f1430be6b87d94e to your computer and use it in GitHub Desktop.
Save 4hg/b0a271f5e720f7b41f1430be6b87d94e to your computer and use it in GitHub Desktop.
Terrible, uninteresting rot13 implementation in ruby.
a=->(c){((c-97+13)%26+97).chr}
b=->(c){((c-65+13)%26+65).chr}
d=->(c){c==32||c<65?(c.chr):c<97?b[c]:a[c]}
p gets.chomp.each_byte.map(&d).join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment