Enigma is a Command Line Interface(CLI) app built in Ruby. This app provides the user with the ability to encrypt a message which can later be decrypted when the encrypted message is read from a text file and processed.
The cipher is partially based on the Caesar Cipher, but uses an additional encryption process based on the user-provided key and date. If the user chooses not to provide a key or date, the program will automatically generate either or both.
Table of Contents
- Ruby 2.7.4
- RSpec 3.11
- decrypt.rb
- Provides "read access" to an encrypted text file
- Calls the decryption processes
- Writes output to decrypt.txt
- decryption.rb
- Facilitates decryption processes
- encrypt.rb
- Provides "read access" to a plaintext file
- Calls the encryption processes
- Writes output to encrypt.txt
- encryption.rb
- Facilitates encryption processes
- enigma.rb
- Calls the encryption/decryption processes
- Receives key and date input from CLI (if provided)
- Directs inputs based on whether encrypt or decrypt has been specified
- creatable.rb
- Creates keys and date if either or both were not provided by the user
- Creates shift and encryption/decryption logic enacted on message
- decrypted_message.txt
- Where a decrypted message's output appears
- encrypted_message.txt
- Where an encrypted message's output appears
- spec
- Folder containing tests for all methods
1. Create a new directory on your computer where you'd like the program to live.
$ mkdir /your_folder/enigma_cipher
2. Navigate into the recently created directory.
$ cd /your_folder/enigma_cipher
3. Copy the repository by clicking on the code button on Github repo page (using SSH).
4. Clone the recently copied repository information into your currenty directory.
$ git clone git@github.com:JohnSantosuosso/enigma_cipher.git
5. Open the repository in your preferred IDE. If you are using VSCode, use the code command shown below:
$ code .
- Locate the message.txt file inside the project and provide the message you wish to encrypt:
- Open your terminal while inside the project directory. Run encryption processes by calling encrypt.rb and specifying required text files.
- Note the CLI message indicating encryption was successful.
- Open encrypted.txt inside the project and view the encrypted message.
$ ruby ./lib/encrypt.rb message.txt encrypted.txt
$ Created encrypted.txt at 09/08/2022 19:46 with the key 61950 and the date 80922.
- Open your terminal while inside the project directory. Run decryption processes by calling decrypt.rb and specifying required text files.
- Note the CLI message indicating decryption was successful.
- Open decrypted.txt inside the project and view the encrypted message.
$ ruby ./lib/decrypt.rb encrypted.txt decrypted.txt
$ Created decrypted.txt at 09/08/2022 19:46 with the key 61950 and the date 80922.
The program extracts the date and key from encrypted.txt to decrypt the message.
- Provide a random five digit key when utilizing CLI to encrypt a message.
- Note the CLI message indicating encryption was successful.
- Open encrypted.txt inside the project and view the encrypted message.
$ ruby ./lib/encrypt.rb message.txt encrypted.txt 82648
$ Created encrypted.txt at 09/08/2022 19:46 with the key 82648 and the date 80922.
The program generates a date value using the current date since a date was not provided.
- Provide a random five digit key when utilizing CLI to encrypt a message.
- Note the CLI message indicating encryption was successful.
- Open encrypted.txt inside the project and view the encrypted message.
$ ruby ./lib/encrypt.rb message.txt encrypted.txt 080922
$ Created encrypted.txt at 09/08/2022 19:46 with the key 82648 and the date 80922.
The program randomly generates a key since a key was not provided.