Created
July 28, 2019 11:30
-
-
Save NAKKA-K/272f19e8f436d1546907f4cdc2c9128b 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
#!/usr/bin/env ruby | |
def main | |
if ARGV.length != 2 | |
puts 'Invalid number of arguments' | |
exit 1 | |
end | |
crypt = ARGV[0] | |
caesar = ARGV[1].to_i | |
crypt.chars do |c| | |
diff = (c.bytes[0] - 65 + caesar) % 26 | |
print (65 + diff).chr | |
end | |
puts | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment