Welcome to my Enigma project. This project uses the Command Line Interface to Encrypt and Decrypt messages.
-
Add a message into the
message.txt
either directly or through the command line interface by typingecho 'your message here' >> ./lib/message.txt
into your command line. -
To encrypt the message type
ruby ./lib/encrypt_runner.rb message.txt encrypted.txt
into your command line. This will encrypt the message and store it to theencrypted.txt
file. You will also see a message in your terminal with the 'key' and 'date', these will be used to decrypt the message. -
To decrypt the message type
ruby ./lib/decrypt_runner.rb encrypted.txt decrypted.txt 'key' 'date'
into your command line using the 'key' and the 'date' from the encrypt message as the 3rd and 4th argument. This will read the encrypted message in theencrypted.txt
file and write the decrypted message to thedecrypted.txt
file. -
To read the
message.txt
,encrypted.txt
ordecrypted.txt
files, runcat 'file path'
in your command line where the file path is the path to the file you want to read.
-
Enigma Class with encrypt and decrypt methods successfully implemented.
-
Encrypt and Decrypt CLI successfully implemented.
Following the project requirements all things were implemented correctly. I would prefer to move the text files to another directory outside of the Lib directory for better organization, and will probably do this on my own after the project eval.
-
Project is broken into logical components - appropriately encapsulated.
-
No classes are unreasonably small or large.
-
Classes do not contain knowledge/info/behavior that they shouldn't know about.
-
Single responsibilities can be articulated.
I broke the project down into one class and four modules. Each module includes methods that only pertain to what the module is designed to do. With only one class there is no issue of classes breaking the law of Demeter. I also focused on keeping my code DRY and made sure to not repeat code.
-
Code is properly indented, spaced, and concise.
-
All class, method, variable, and file names follow convention.
-
Most of the enumerables and data structures chosen are the most efficient.
-
Implemented multiple hashes in a logical manner.
In order to follow Turing's rules for keeping methods below 12 lines, I used case statements within the encrypt.rb
and decrypt.rb
modules. I personally think this makes the code harder to read, but using an if/else
statement makes the method lengthy. I also plan on going back through and refactoring my shifted_characters
method in the shift
module into a hash. For now it works well and runs as intended, but after completing the project it occurred to me that this information should be a hash.
-
Every class has a spec file and every method within a class is completely tested to verify the expected behavior.
-
Module methods are tested within the Class spec file that they apply to.
-
Edge cases are addressed in testing.
-
Tests were written first before implementation of code.
-
Simplecov shows coverage over 99% coverage.
Testing for an expected output of a random number seems impossible at my skill level. Testing that it is an Integer
and that it's size was as intended felt like a copout, but it worked to get the coverage. Some tests had to be changed along the way as the project was built out and some had to be added as new ideas emerged and were implemented.
-
Over 30 commits.
-
Uses logical pull request workflow.
This was the first project where I did not run into any Github issues, and that was a nice change of pace. Breaking the rule about not merging your own pull requests also felt good.