Frequency Analysis Simulator
The purpose of this project is to decrypt a monoalphabetic substitution cipher using frequency analysis and find the optimal algorithm and conditions of decrypting a Vigenere cipher.
Methods of Cryptanalysis
- Frequency Analysis
- Kasiski Examination
- Freidman Test
- Kerckhoff’s Method
- Dictionary attack using Words and WordNet API
Usage
- Clone this repo with
git clone https://github.com/varunsingh87/Frequency-Analysis-Simulator
(for help see the GitHub documentation). - Run
mvn package
- Run the GUI with the following command:
mvn compile exec:java"
Collecting Data
Run the following command for data collection of a single input (~480 runs/data points):
mvn compile exec:java -Dexec.mainClass="dataanalysis.DataCollector"
Run the following command for data population of experiment data. To use a different key you will need to edit the default in DataCollector.java and make a new folder and subfolders of all the combinations of key length and caesar decryption algorithms in the following format:
outputs/
[ioc, friedman]_[kasiski, kerckhoff]/
Generate executable file
To create an executable file without the user needing the Java Runtime Environment on his or her computer, use
the jpackage
utility from the Java Development Kit:
**Mac
**: jpackage --input target/ --name 'Frequency Analysis Simulation' --main-jar com.varunsingh.frequencyanalysissimulator-1.00.jar --main-class frequencyanalysissimulator.presentation.main.Main --type dmg --icon ./assets/icon.icns
*Windows
**: jpackage --input target/ --name 'Frequency Analysis Simulation' --main-jar com.varunsingh.frequencyanalysissimulator-1.00.jar --main-class frequencyanalysissimulator.presentation.main.Main --type exe --icon ./assets/icon.ico
*Does not work on Mac
*Linux
**: jpackage --input target/ --name 'Frequency Analysis Simulation' --main-jar com.varunsingh.frequencyanalysissimulator-1.00.jar --main-class frequencyanalysissimulator.presentation.main.Main --type deb --icon ./assets/icon.ico
*Does not work on Mac
Process
Phase I: Monoalphabetic Ciphers: July 22, 2019 - February 16, 2020
Phase II: Vigenere Ciphers: September 26, 2022 - May 8, 2023
Phase III: Graphics, Refactors, Variants: July 22, 2023 - November 26, 2023
Phase III
- Data GUI
- Data collection GUI
- Variants of Vigenere cipher
Phase II
Phase I
Concepts Used
- Advanced Data Structures - Java Collections API, including TreeSet, HashMap, ArrayList
- Layered Architecture - separated into presentation code (Java Swing framework), business logic (pure Java), and data analysis module (pure Java I/O)
- Recursion
Built With
- Java - The programming language
- Maven - The dependency management system
- JUnit - The testing framework
Sources of Research
- Inspiration from The Code Book by Simon Singh
- The Cryptanalyst by Helen Fouche Gaines
- Michigan Technological University - explanations of the Kasiski Examination and index of coincidence with working examples