Skip to content

JohnSantosuosso/enigma_cipher

Repository files navigation

Enigma Cipher

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

Table of Contents
  1. ➤ Technical Requirements
  2. ➤ Project Files Description
  3. ➤ Getting Started
  4. ➤ Scenario 1: Encrypting a Message (no date and key provided)
  5. ➤ Scenario 2: Decrypt an Encrypted File
  6. ➤ Scenario 3: Encrypt a Message (key provided)
  7. ➤ Scenario 4: Scenario 4: Encrypt a Message (date provided)
  8. ➤ Credits

💻 Technical Requirements

  • Ruby 2.7.4
  • RSpec 3.11

💾 Project Files Description

  • decrypt.rb
    1. Provides "read access" to an encrypted text file
    2. Calls the decryption processes
    3. Writes output to decrypt.txt
  • decryption.rb
    1. Facilitates decryption processes
  • encrypt.rb
    1. Provides "read access" to a plaintext file
    2. Calls the encryption processes
    3. Writes output to encrypt.txt
  • encryption.rb
    1. Facilitates encryption processes
  • enigma.rb
    1. Calls the encryption/decryption processes
    2. Receives key and date input from CLI (if provided)
    3. Directs inputs based on whether encrypt or decrypt has been specified

Some other supporting files

  • creatable.rb
    1. Creates keys and date if either or both were not provided by the user
    2. Creates shift and encryption/decryption logic enacted on message
  • decrypted_message.txt
    1. Where a decrypted message's output appears
  • encrypted_message.txt
    1. Where an encrypted message's output appears
  • spec
    1. Folder containing tests for all methods

📖 Getting Started

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).

183747041-40f47875-442e-4008-8d00-8c45bf2731fe

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 .

🔸 Scenario 1: Encrypting a Message (no date and key provided)

  • Locate the message.txt file inside the project and provide the message you wish to encrypt:

  • enigma

  • Open your terminal while inside the project directory. Run encryption processes by calling encrypt.rb and specifying required text files.
  • $ ruby ./lib/encrypt.rb message.txt encrypted.txt
  • Note the CLI message indicating encryption was successful.
  • $ Created encrypted.txt at 09/08/2022 19:46 with the key 61950 and the date 80922.
  • Open encrypted.txt inside the project and view the encrypted message.

  • enigma2

🔸 Scenario 2: Decrypt an Encrypted File

  • Open your terminal while inside the project directory. Run decryption processes by calling decrypt.rb and specifying required text files.
  • $ ruby ./lib/decrypt.rb encrypted.txt decrypted.txt
  • Note the CLI message indicating decryption was successful.
  • $ 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.

  • Open decrypted.txt inside the project and view the encrypted message.

  • Screen Shot 2022-09-03 at 6 01 42 PM

🔸 Scenario 3: Encrypt a Message (key provided)

  • Provide a random five digit key when utilizing CLI to encrypt a message.
  • $ ruby ./lib/encrypt.rb message.txt encrypted.txt 82648
  • Note the CLI message indicating encryption was successful.
  • $ 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.

  • Open encrypted.txt inside the project and view the encrypted message.

🔸 Scenario 4: Encrypt a Message (date provided)

  • Provide a random five digit key when utilizing CLI to encrypt a message.
  • $ ruby ./lib/encrypt.rb message.txt encrypted.txt 080922
  • Note the CLI message indicating encryption was successful.
  • $ 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.

  • Open encrypted.txt inside the project and view the encrypted message.

📜 Credits

John Santosuosso

GitHub Badge LinkedIn Badge

About

CLI app built in Ruby. This app uses a series of shifts to encrypt a message. The shifts can also be reversed to decrypt an encrypted message.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published