Skip to content

turingschool-examples/caesar_cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Caesar Cipher

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.

Submission instructions

  1. Fork the repo above
  2. Clone your fork
  3. Push your solution to your fork
  4. Use Github's interface to create a pull request

Iteration 0

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"

Iteration 1

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"

Iteration 2

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 "

Iteration 3

Translate ciphertext to English

  $ caesar = Caesar.new 
  => #<Caesar:0x007fa1ab98cac0>
  $ caesar.cipher_to_eng("qeb nrfzh yoltk clu grJmp lsbo qeb ixwv ald") 
  => "the quick brown fox jumps over the lazy dog"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages