Enigma Simulator banner

Enigma Simulator

11 devlogs
12h 12m 29s

Simulates the famous Enigma machine from WW2. You set your plugboard pairs, rotors, and type your message and it's encrypted! Even if someone sees your plugboard pairs and rotors, if they try it themselves they will get a result because you and yo…

Simulates the famous Enigma machine from WW2. You set your plugboard pairs, rotors, and type your message and it’s encrypted! Even if someone sees your plugboard pairs and rotors, if they try it themselves they will get a result because you and your buddy have more than 1 message! Look at the instructions page linked in the footer.

Demo Repository

Loading README...

Simha Saraswati

Shipped this project!

Hours: 12.21
Cookies: 🍪 252
Multiplier: 20.68 cookies/hr

Made the Enigma machine, based on the enigma m3 from WW2! You can use it to send messages to your buddies, and just like the real machine, if somebody uses your same rotors and plugboard pairs, unless they sent the same number of messages of the same length(gets the rotor to right position). Overall, I think it was really cool. Before this I did mainly back-end, so doing front-end was challenging for me. Overall, i really like the layout!

Simha Saraswati

COMPLETELY FINISHED. A big bug that i hadn’t noticed before (because i didn’t type huge messages) is that the rotate rotor logic was wrong. Last rotors wouldn’t seemed like they would never move. What was happening was they were moving every time before. Idrk how to explain it, but the fix was that you only check rotor at position i if rotor at position i-1 moved. then i added the whole cookie logic so you can actually keep the rotor positions without leaving the tab open. And because i added cookies, i also had to add a reset rotor button. Also i added the instructions page. Done now!

0
Simha Saraswati

FINISHED (most of) THE PROJECT!! Now you can acutally see the plugboard pairs, u can reroute them if you make a mistake. Only thing i need to do now is make an explanation page that says how to use the tool cause honestly if u don’t know how the enigma machine works u probably wouldn’t know what the hell is going on.

0
Simha Saraswati

Made the Rotors better. Now you can choose how many rotors you want using the slider and choose the rotor by filling in the box!

0
Simha Saraswati

If you want to send multiple messages without resetting rotor position, you can do that now! you can delete the plaintext and start typing a new message and the ciphertext will reflect that! I spent some time on trying to make typos work(you typed wrong letter so you delete it and replace) but this doesn’t work because then the program uses wrong rotor positions (and this is historical, no way to fix it). Theoretically you could turn the rotor BACK by how much they delete but that’s just not worth it. If you can’t type that’s a u problem. Also, instead of using the plaintext itself as a queue and removing from it, i am using a position variable that indicates up till where you have calculated the ciphertext till. This way you can still see the plaintext when you copy the ciphertext.

0
Simha Saraswati

I made the input method better. Basically, now it will calculate the encrypted method every key press, but then we can’t necessarily keep up, lets say user copy pasted a message or maybe is just typing fast(bc we use animation) we won’t encrypt everything. So my first idea was to encrypt everything in the input box every time we press new key, but that doesn’t work becaus then it say the user puts in the alphabet, we will consider the message aababcabcd which is wrong. So then i thot, lets keep a track of what is the longest message that we know they have entered and only calculating the new part. Once enter is pressed, clear out plaintext. However, that doesn’t work because there are conflicting accounts of “latest calculated string” so it fails on fast type. I think the problem there was something to do with requests being handled on sepereate threads. What i finally did, is for once in my life found a practical implementation of datastructures. I implemented a queue directly into the plaintext and a flag to see is stuff being handled rn. If yes, you don’t do anything because your character wiill eventually get processed as part of the queue. If no, then start the queue, and if new characters are typed they will be added too.

2

Comments

Simha Saraswati
Simha Saraswati 3 months ago

Btw, after typing the message i reloded and then pasted the encrypted message

Simha Saraswati
Simha Saraswati 3 months ago

Just realised the audio, i was listening to music so i didn’t realise and my fam was watching a movie in the background

Simha Saraswati

Made lampboard! it looks kinda bad rn but i am hopping to ad an animation and maybe make the padding round somehow. However, i need to first focus on plugboard, keyboard, maybe rotors animation.

2

Comments

Simha Saraswati
Simha Saraswati 3 months ago

BTW, there is no animation for non letter characters, but they show up in final ciphertext

Simha Saraswati
Simha Saraswati 3 months ago

Just realised the audio, i was listening to music so i didn’t realise and my fam was watching a movie in the background

Simha Saraswati

Removed the reversed alphabet. Honestly, idrk what else i was tryna do but i did a bunch of cleanup and then it didn’t work or smth

Attachment
0
Simha Saraswati

It’s working “Yay!” basically the problem was that i wasn’t shifting back when exiting a rotor. lets say user typed ‘A’. When you enter rotor 1, you don’t enter wire ‘A’, you enter wire ‘A’+position. Lets say the output of wire ‘A’+position is ‘B’. You can’t input ‘B’ into rotor 2, you have to input ‘B’-position because you need to shift back so that you can factor in the position of rotor 2. That was hella confusing but idrk how to explain it that well

Attachment
Attachment
0
Simha Saraswati

Dealing with scope errors right now and it’s hella annoying cause according to w3schools, if i declare it as var, it will automatically be accessible inside the function which doesn’t seem to be teh case. Btw, i used small python script to generate a reveresd alphabet for each rotor, that denotes the path when going back through the rotor. I will probably still need to debug the logic for doing this backward alphabet, but the changes will be in python file now. This way the js file stays clean

Attachment
0
Simha Saraswati

I tried to implement the whole thing, but right now, even though it’s scrambling into a letter, the decryption is not working. Enigma machine is supposed to be, lets say you used rotors 1 0 and 4, with no leads, then typed “HELLO WORLD” and got “XERCL DSOPL” then somebody else should be able to use rotors 1 0 4 and type “XERCL DSOPL” to get “HELLO WORLD” but right now it’s not working

Attachment
0
Simha Saraswati

Finish the setup, now i am moving on to the actual encryption. AKA, the plugboard, rotors, reflector, rotors, plugboard sequence. Also, i finished the plugboard logic.

Attachment
0