Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

A Java program that decrypts cryptograms without keys using frequency analysis

Notifications You must be signed in to change notification settings

varunsingh87/Frequency-Analysis-Simulator

Repository files navigation

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 <<<<<<< HEAD
  • Dictionary attack using WordNet API =======
  • Dictionary attack using Words and WordNet API

930ef91784de248ecdf0fac7deb03a4ec249b82c

Usage

  1. Clone this repo with git clone https://github.com/varunsingh87/Frequency-Analysis-Simulator (for help see the GitHub documentation).
  2. Run mvn package
  3. 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

<<<<<<< HEAD Do the same for any other Java class with a main method that you would like to turn into an executable file.

=======

930ef91784de248ecdf0fac7deb03a4ec249b82c

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

<<<<<<< HEAD The purpose of phase III was to study classical ciphers further and implement GUIs to reduce the project's reliance on Google Sheets for data visualization and analysis. The data analysis module in Version 3 contains two GUIs that allow a user to collect and visualize the accuracy of the Vigenere decryption algorithms with a particular message when encrypted with the Vigenere cipher.

=======

930ef91784de248ecdf0fac7deb03a4ec249b82c

  • 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 <<<<<<< HEAD analysis module (I/O Streams) ======= analysis module (pure Java I/O)

930ef91784de248ecdf0fac7deb03a4ec249b82c

  • 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