Using this repo, build a well tested Ruby program that translates a message using the Caesar Cipher.
You can read more about the Caesar Cipher here.
Note: We are shifting left. So if we shift 3, A is now X, D is now A and so forth.
- Fork the repo above
- Clone your fork
- Push your solution to your fork
- Use Github's interface to create a pull request
Translate English to ciphertext
- lowercase letters
$ caesar = Caesar.new
=> #<Caesar:0x007fa1ab98cac0>
$ caesar.eng_to_cipher("the quick brown fox jumps over the lazy dog", 3)
=> "qeb nrfzh yoltk clu grjmp lsbo qeb ixwv ald"
Translate English to ciphertext
- Case sensitivity
$ caesar = Caesar.new
=> #<Caesar:0x007fa1ab98cac0>
$ caesar.eng_to_cipher("The quick brown fox JUMPS over the lazy DOG", 3)
=> "Qeb nrfzh yoltk clu GRJMP lsbo qeb ixwv ALD"
Translate English to ciphertext
- from a file
# in input.txt
I am in a file
$ caesar = Caesar.new
=> #<Caesar:0x007fa1ab98cac0>
$ caesar.from_file("input.txt")
=> "F xj fk x cfib "
Translate ciphertext to English
$ caesar = Caesar.new
=> #<Caesar:0x007fa1ab98cac0>
$ caesar.cipher_to_eng("qeb nrfzh yoltk clu grkmp lsbo qeb ixwv ald")
=> "the quick brown fox jumps over the lazy dog"