Skip to content

A MATLAB program that decodes encrypted text using letter frequency analysis and probabilistic modeling.

Notifications You must be signed in to change notification settings

KaitKirt/cryptography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Cryptography Decoder (MATLAB)

This repository contains a cryptographic decoding project written in MATLAB. It was developed as part of the CMOR220 course at Rice University during Spring 2024.

πŸ“œ Project Overview

The goal of this project is to decrypt an encoded text using letter frequency analysis and probabilistic modeling. The decoder uses a transition matrix of letter probabilities and iteratively searches for the most likely decoding key by maximizing a log-likelihood function.

πŸ“‚ Files Included

  • Project3.m β€” Main script with all decoding functions.
  • encodedtext.txt β€” File containing the encrypted message.
  • letterprob.mat β€” Matrix of letter pair probabilities used for scoring.

βš™οΈ Features

  • Converts text to numerical ASCII values for processing.
  • Implements a stochastic optimization technique (random swaps) to improve the decryption key.
  • Uses a transition matrix to evaluate the likelihood of letter pairings.
  • Decodes and cleans output by mapping back to readable text.

πŸ’‘ Key Concepts

  • ASCII encoding and decoding
  • Markov transition matrices
  • Log-likelihood scoring
  • Monte Carlo-style optimization
  • Basic cryptanalysis techniques

πŸ§ͺ How to Run

Make sure all files (Project3.m, encodedtext.txt, and letterprob.mat) are in the same directory. Then run in MATLAB:

Project3

About

A MATLAB program that decodes encrypted text using letter frequency analysis and probabilistic modeling.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages