About
From assignment to workbench
Decipher began as a stack of cryptography assignments — the CS641 series, where each week meant breaking a harder cipher by hand and in Python: substitution, Vigenère, a substitution-permutation network, a from-scratch DES, and finally RSA. The original solvers still live in the legacy/ directory of the repository.
This is that coursework, rebuilt as something you can actually use. The Python scripts have been reimplemented in TypeScript and wired into a single interactive workbench — the same algorithms, now with live frequency analysis, automatic cipher detection, and a solver that streams its progress as it climbs toward readable English. Nothing is uploaded anywhere: every byte is processed on your own machine, and the heavy hill-climb runs off the main thread in a Web Worker so the page never freezes.
How the attacks work
Index of coincidence
Measures how often two randomly drawn letters match. English sits near 0.067; a repeating-key cipher flattens it toward 0.038. Decipher uses it both to fingerprint the scheme and to recover a Vigenère key length.
χ² frequency fit
Scores a candidate plaintext against the expected English letter distribution. Every Caesar, Affine and Rail Fence key is ranked by how little it deviates.
Quadgram hill-climbing
The heart of the substitution solver. Starting from a random key, it swaps two letters at a time and keeps the swap whenever the four-letter log-probability of the decrypt improves — restarting from fresh keys to escape local maxima.
Repeating-key XOR
Key length is found by minimising the normalised Hamming distance between blocks; each key byte is then the single byte that makes its column look most like English.
Built with
Next.js 15 and React 19 on the App Router, Tailwind CSS v4, and a quantized quadgram corpus served as a cached binary. The block and public-key math — DES over its FIPS bit tables, RSA over native BigInt — is implemented from scratch, no crypto libraries. It deploys as a fully static, edge-cached site.