Last active
August 29, 2015 14:06
-
-
Save sethyanow/d4f54f125e20998a63b6 to your computer and use it in GitHub Desktop.
it's a simple rot13 in ruby
This file contains 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
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