Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shreyansh26/solving-substitution-ciphers-using-mcmc

Solving substitution ciphers using Markov Chain Monte Carlo (MCMC)
https://github.com/shreyansh26/solving-substitution-ciphers-using-mcmc

cryptography mcmc probability sampling-methods substitution-cipher

Last synced: 5 days ago
JSON representation

Solving substitution ciphers using Markov Chain Monte Carlo (MCMC)

Awesome Lists containing this project

README

        

# Solving Substitution Ciphers using Markov Chain Monte Carlo (MCMC)

I have written about the explanation of the algorithm and the code in this [blog post](https://shreyansh26.github.io/post/2023-07-22_solving_substitution_cipher_using_mcmc/).

* [prep_freq_counts.py](prep_freq_counts.py) - Bigram frequency/probability calculation
* [solve_cipher.py](solve_cipher.py) - Solve the substitution cipher given in [ciphertext.txt](ciphertext.txt) using MCMC and compare it with the plaintext given in [plaintext.txt](plaintext.txt).

## To run

```bash
pip install -r requirements.txt
python prep_freq_counts.py
python solve_cipher.py
```