Skip to content

Instantly share code, notes, and snippets.

@NAKKA-K
Created July 28, 2019 11:30
Show Gist options
  • Save NAKKA-K/272f19e8f436d1546907f4cdc2c9128b to your computer and use it in GitHub Desktop.
Save NAKKA-K/272f19e8f436d1546907f4cdc2c9128b to your computer and use it in GitHub Desktop.
#!/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