Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
This is a ruby gem that simulates the Enigma Machine. The Enigma Machine is a cipher mechanism created by Arthur Scherbius a German Engineer. The machine is capable of transcribing text into coded information as a means of encryption. As of its time during World War II, it was the most sophisticated means of encryption. During the war, both the Allies and the Axis countries were looking for a new way to encrypt messages - a way that would result in complete security this was when the Enigma was born. By the end of World War II Alan Turing with the help of is friends where able to crack the enigma which helped Britain and their allies during the war. More on the Enigma.
The inner working of an enigma machine has three rotors, each rotors has wrapped around it the 26 letters. When a key is pressed it moves the rotor ahead one alphabet. The other rotors kick off after the first has completed a revolution and so for the third. When this is done, text in plain english becomes gibberish. Before you start encrypting you and your recipient must agree upon a key which can be set on the machine. Find out more about the enigma machine by watching this video.
Though, my implementation of the Enigma Machine is slightly different from that of World War II but here is the catch
The rotors: they are denoted by five digit numbers e.g. 97239
The offsets: the date of message transmission is also factored into the encryption
Encrypting a message
Decrypting a message
The offsets and keys can be calculated by the same methods above. Then each character is rotated backwards instead of forwards.
Cracking a message When the key is not known, the offsets can still be calculated from the message date. We believe that each enemy message ends with the characters "..end..". Use that to determine when you’ve correctly guessed the key.
Add this line to your application's Gemfile:
gem 'enigma_engine'
And then execute:
$ bundle
Or install it yourself as:
$ gem install enigma_engine
The tool is used from the command line like so:
View Help
enigma help
To see help file
Encrypting a message
enigma encrypt [message.txt] [encrypted.txt]
created encrypted.txt with key 82648 and date 090216
That will take the plaintext file message.txt and create an encrypted file encrypted.txt.
Decrypting a message Then, if we know the key, we can decrypt like so:
enigma decrypt [encrypted.txt] [decrypted.txt] [82648] [030415]
created ‘decrypted.txt with key 82648 and date 030415
Cracking a message But if we don’t know the key, we can try to crack it with just the date like so:
enigma crack [decrypted.txt] [cracked.txt] [030415]
created ‘cracked.txt with key 82648 and date 030415
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/andela-sdamian/EnigmaEngine. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that enigma_engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.