Skip to content

Instantly share code, notes, and snippets.

def rot13(string)
a = 'a'.ord
z = 'z'.ord
capital_a = 'A'.ord
capital_z = 'Z'.ord
decyphered_string = ""
string.unpack('c*').each do |char|
if (a..z).cover?(char)
modified_char = (((char - a) + 13) % 26) + a