Last active
December 11, 2015 09:48
-
-
Save epson121/4582394 to your computer and use it in GitHub Desktop.
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
''' | |
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