Skip to content

Instantly share code, notes, and snippets.

@sethyanow
Last active August 29, 2015 14:06
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 sethyanow/d4f54f125e20998a63b6 to your computer and use it in GitHub Desktop.
Save sethyanow/d4f54f125e20998a63b6 to your computer and use it in GitHub Desktop.
it's a simple rot13 in ruby
def rot13(string)
string.bytes.map { |n|
if n.between?(78, 90) || n.between?(110, 122)
(n - 13).chr
elsif n.between?(65, 89) || n.between?(97, 109)
(n + 13).chr
else
n.chr
end
}.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment