Skip to content

st7ma784/EnigmaDemo

Repository files navigation

Getting Started With ML...

Todays Problem: Enigma

Enigma Machine

Understanding Enigma Rotors

The Enigma machine uses a series of rotors to encrypt messages. Each rotor is a disk with 26 positions, corresponding to the letters of the alphabet. When a key is pressed, an electrical current passes through the rotors, which substitute the input letter with another letter based on the rotor's internal wiring. The rotors then rotate, changing the substitution pattern for the next key press.

Abstracting Rotors as an Assignment Matrix

The rotor mechanism can be abstracted using an assignment matrix. This matrix represents the wiring of the rotor, where each row corresponds to an input letter, and each column represents the output letter after substitution. For example, if the letter 'A' is substituted with 'D', the matrix would have a 1 at the position (A, D) and 0 elsewhere in that row. By using such a matrix, we can simulate the rotor's behavior programmatically, allowing for flexible and efficient encryption and decryption processes.

Because Enigma machines use multiple rotors, the assignment matrix is applied iteratively. The output of one rotor becomes the input of the next rotor, and so on. The final output is the result of passing the input through all rotors in sequence.

The Challenge

From a random setting of our data, can we use a neural network or Linear Algebra to learn the assignment matrix of the rotors?

QUICK START:

Step Zero: Set up env

To set up a virtual environment and install the required packages with pip, follow these steps:

  1. Create a virtual environment:
python3 -m venv env
  1. Activate the virtual environment:
  • On Windows:
    .\env\Scripts\activate
  • On macOS and Linux:
    source env/bin/activate
  1. Install the required packages:
pip install -r requirements.txt

Step one:

  • Put your dataset into the DataModule.py file.
  • This details how to load your data onto the server. An example is given for Enigma, generating a random encoding.

Step two:

Step three:

  • Deploy a Sweep, and launch an Agent if you want to test everything!
  • This is done by running '''python CreateWandBSweep.py'''

Step four:

  • Have a look at the files generated! Are they what you expected? what kind of constraints can you try putting on the problem?

FAQ:

  • If you want to ask any questions, please use the SLIDO code on the board!
  • All runs will default log to W&B, which we'll use to identify and share solutions during the Lab!

About

Demo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages