the-lambda-way / bruteforce-enigma

A tool for cracking and bruteforcing Enigma ciphers.
MIT License
19 stars 3 forks source link

Question About Cracking other versions of Enigma #8

Closed Smiril closed 9 months ago

Smiril commented 1 year ago

Hello .... on Linux Debian it cracking really fast but only with the given "plug" and given "rotors" ....

is there a way to rewrite your code to crack this one: https://github.com/Smiril/Kortin-Enigma.git

the given Cyper "FTMW" is translated to "THAT" with plug "AT ME" should be "TEST" and not "THAT" ... yes there are differences in rotors and this "MSG" is from an 5 rotor ... means 5 order (1-9), 5 rings (A-Z), 5 pos(A-Z) , 1 reflector 26(A-Z)once , 1 notch 5(A-Z)once , 1 plug 10(A-Z)once translated: 5 ROTORS(5x26LETTERS), 5 WHEEL(5x1-9), 5 START(5xA-Z), 5 RINGS (5xA-Z), 1 REFLECTOR(26LETTERS), 1 NOTCH(5LETTERS), 1 PLUG(10LETTERS)

the Turing Code is also different from your code in my version ...

your output below ...

Breaking enigma...
#    Score         Refl     Rotor Order         Ring Pos   Rotor Pos  Text  
 1   -2.574637   UKWC     IV    IV    IV       5  0  0    4  9 23   THAT
 2   -2.574637   UKWC     IV    IV    IV       3  0  0    2  9 23   THAT
 3   -2.574637   UKWC     IV    IV    IV       4  0  0    3  9 23   THAT
 4   -2.574637   UKWC     IV    IV    IV       6  0  0    5  9 23   THAT
 5   -2.574637   UKWC     IV    IV    IV       1  0  0    0  9 23   THAT
 6   -2.574637   UKWC     IV    IV    IV      11  0  0   10  9 23   THAT
 7   -2.574637   UKWC     IV    IV    IV      12  0  0   11  9 23   THAT
 8   -2.574637   UKWC     I     I     II       0  8  0   14  3 13   THAT
 9   -2.574637   UKWC     I     I     II       0  7  0   14  2 13   THAT
10   -2.574637   UKWC     I     I     II       0  6  0   14  1 13   THAT

Elapsed time: 0.16 seconds
the-lambda-way commented 1 year ago

I don't think there is a way to rewrite the code for your ciphertext "FTMW". The problem is, "TEST" scores at -4.392 and "THAT" scores at -2.575, so "THAT" will always win out. This can happen with short ciphertexts because there are multiple valid decryptions. If you make your ciphertext longer, then you should be able to find a unique decryption for it. If you are testing your Enigma project output to mine for validation, that is what I suggest.

With a more extensive rewrite, I may be able in the future to combine equal plaintexts on the scoreboard so that it shows more alternative solutions. I put this in my TODO for later analysis.

the-lambda-way commented 1 year ago

In cryptography, there is the concept of unicity distance, where a ciphertext shorter than the unicity distance will have multiple valid decryptions. According to a paper I found on cryptocellar, the unicity distance for Enigma is 23 characters. So if you want a unique decryption for testing, make your ciphertext longer than 23 characters.

Smiril commented 1 year ago

Thank you for this information

I added on my todo list for this week You said longer than 23 letters … I will Test it