N
notnorwegian
tryong to do a ROT13(http://en.wikipedia.org/wiki/Rot_13) encrypter/
decrypter.
x = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
y = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
arr = x.split(//).zip(y.split(//))
dict = Hash[*arr.flatten]
puts "Input phrase: "
phrase = gets
rotated = ""
for x in (0..phrase.length()-1)
rotated = rotated + dict[phrase[x].chr]
end
puts rotated
'+' cant convert nil into string
cant convert nil into string
puts dict[phrase[2].chr] works though...
decrypter.
x = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
y = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
arr = x.split(//).zip(y.split(//))
dict = Hash[*arr.flatten]
puts "Input phrase: "
phrase = gets
rotated = ""
for x in (0..phrase.length()-1)
rotated = rotated + dict[phrase[x].chr]
end
puts rotated
'+' cant convert nil into string
cant convert nil into string
puts dict[phrase[2].chr] works though...