mww / enigma-java Goto Github PK
View Code? Open in Web Editor NEWA simple machine to crack enigma encoded messages, written in java.
A simple machine to crack enigma encoded messages, written in java.
A simple simulation of an Enigma machine. You provide an encrypted message and this will try all the different combinations of rotors, reflectors, and starting positions to find the proper key. The messages and decrypes will be in ALL CAPS with no spaces. To determine which solution is correct this does a letter frequency analysis and a digraph frequency analysis on the dycrypted message. Using the known frequency of letters and digraphs in the English language, this assigns a score to each decryption. The messages with the lowest scores are kept and displayed. In my experiments, on a message of 80 characters is more than enough to make a very good guess. Very short messages are much harder. This was built using an Enigma simulator from http://enigmaco.de/enigma/enigma.html as an oracle. The rotor mappings and other information was taken from the Enigma and Enigma Rotor wikipedia pages. http://en.wikipedia.org/wiki/Enigma_machine http://en.wikipedia.org/wiki/Enigma_rotor_details The letter frequencies used in the frequency analysis can be found in the Letter frequency wikipedia article. http://en.wikipedia.org/wiki/Letter_frequencies To build use: $ gradle clean test $ gradle shadowJar To run use: $ java -jar build/libs/enigma-java-0.1-all.jar The program takes a variety of arguments: -message: Message is a required argument, it is the encrypted message to break. -crib: If you have a crib, a known word in the decrypted message, you can provide it to help identify the proper decoded message. -rotors: The rotors to use. This should be a comma separated list. By default the value is "1,2,3,4 5". If you know the message doesn't use rotor 4, then you can reduce the number of combinations tried by changing rotors to "1,2,3,5". -reflectors: Same as rotors, but which reflectors to use. By default this is "A,B,C", but the simulator linked above only uses rotor B, so you can speed up processing a lot by only specifying B. -results: The number of results to display. By default this is 3. -num_threads: The number of threads to use while processing. By default this is 8. Some sample messages you can try are: ZTQBLVXKPBPGAVQBRYDYQEZNKRLMZTMRGBJSQKHDPHHNTNIDLYVFCOKZYYSMJFAHQBTEAVFKOXRPSQX which decrypts to THISISASLIGHTLYLONGERTESTSOIHAVETOSEEIFICANKEEPWRITINGALONGERSTRINGTOUSEASINPUT with KEY=AAB Rotors: 1, 2, 3 Reflector: B PCSONKFYSIQHZJCVFLPAWUWTXWYNWPTCCLOJNNKNCNECAAQPYNEWIFHVDZQIWYTXMEQQMZ which decrypts to IDONTREALLYKNOWWHATTHISMESSAGEISGOINGTOSAYBUTIMGOINGTOKEEPTYPINGANYWAY with KEY=TJB Rotors: 5, 1, 4 Reflector: B MTVZLRUGJUPYISBINSDHPNXNJVYTX which decrypts to THISISASHORTMESSAGENOCRACKING with KEY: TJB Rotors: 3, 1, 4 Reflector: B but only is you provide the crib SHORT
It would be super awesome if you could provide a pre-built jar file for download on this repo. I am sure some people would appreciate it. :-)
Hi, mww
I am very interesting about this decryption program, but I do not have any experience with Java.
At the meantime I have a encrypted message "CPKJUCVAPYLWFTRYIBCPVOHVAVNJWNSEUQUNOISWWUWHJEFNUSBAVRVNNBMPECQLGCJISGHYOCQVVXVYKVWZOMFTKBMHSXLBLZIYYEBJQHYEKMBKJTLPHNHCSVANFTUQRJLXDAMLCPSNYZAYZBMFCLYMYPFXRMODTUODOFXVQMUJMBAATLYABFUMVPRDNJXILKYQXCJCHKCXZVCFSXTHUNTYZREUXVBJODKQCEKYGOXJAZTCYCMETCWQHCYAZGVWGNIRPFDUXADLEWJUMWDKTCFUFUHICPFXBADKBBLXAUIADSSJFNURSKAVQFGDWPPKLZEJGBEYVYXCPSOZESPANACFSARLWUTCQSIFRDWOCFEPWKJAEMMUEDYXPOHKIW" that is generate by http://www.enigmaco.de/enigma/enigma.swf.
I believe your program can decrypt that message. Would you please upload the file after compiled. So I can run it at my computer. Thanks for your help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.