Skip to content

Instantly share code, notes, and snippets.

@epson121
Last active December 11, 2015 09:48
Show Gist options
  • Save epson121/4582394 to your computer and use it in GitHub Desktop.
Save epson121/4582394 to your computer and use it in GitHub Desktop.
'''
Caesar cipher with a swap by 3
2 implementations
'''
def c(s)
s.split("").map{|s|(65+(s.ord+16)%26).chr}.join()
end
def c2(s)
s.each_char do |s|
print (65+(s.ord+3+13)%26).chr
end
end
p c("ABCCBAZZZ")
c2("ABCCBAZZZ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment