Skip to content

Repository files navigation

Decipher

An interactive cryptanalysis workbench that runs entirely in your browser.

Encrypt, decrypt, and break classical ciphers — from Caesar to DES and RSA — with live frequency analysis, automatic cipher detection, and a quadgram-scoring solver that cracks monoalphabetic substitution ciphers with no key at all. Every byte is processed on your own device; nothing is ever uploaded.

Decipher grew out of the CS641 cryptography assignments — a series of hand-and-Python cipher breaks. The original solvers still live under legacy/; this project reimplements them in TypeScript and wires them into a single interactive tool.

Features

  • Automatic detection — index of coincidence, χ² and entropy fingerprint the ciphertext and rank the most likely schemes.
  • Keyless solvers — brute-force Caesar and Affine, IoC-driven Vigenère key recovery, and a quadgram hill-climb that reads plain substitution ciphers with no key.
  • Real block & public-key crypto — a from-scratch DES (ECB/CBC) over the FIPS bit tables, and educational RSA attacks (modulus factoring and the low-exponent e-th root) over native BigInt.
  • Private by construction — the heavy hill-climb runs off the main thread in a Web Worker. No servers, no logging, no network round-trips for your plaintext.

Nine ciphers ship in the workbench: Caesar & Atbash, Affine, Vigenère, Monoalphabetic Substitution, Rail Fence, Playfair, XOR, DES, and RSA.

Tech stack

  • Next.js 15 (App Router) + React 19
  • Tailwind CSS v4
  • TypeScript, Web Workers, native BigInt
  • A quantized quadgram corpus served as a cached binary (public/quadgrams.bin)

Getting started

npm install
npm run dev

Open http://localhost:3000.

To rebuild the quadgram model from a corpus:

npm run quadgrams

Production build

npm run build
npm run start

Deploy on Vercel

The app is a standard Next.js project and deploys to Vercel with zero configuration:

  1. Push this repository to GitHub.
  2. Import it at vercel.com/new — the framework is detected automatically.
  3. Deploy. No environment variables are required.

Deploy with Vercel

Optionally set NEXT_PUBLIC_SITE_URL to your production domain so Open Graph / canonical URLs resolve correctly.

Run with Docker

The image uses Next.js standalone output for a small final layer.

# Build and run directly
docker build -t decipher .
docker run -p 3000:3000 decipher

# …or with Docker Compose
docker compose up --build

Then open http://localhost:3000.

Project layout

app/            Next.js routes (landing page, workbench, about)
components/     Shared UI (stats panel)
lib/
  ciphers/      Cipher implementations and attacks
  analysis.ts   Text statistics + heuristic classifier
  quadgrams.ts  Quadgram scorer and binary loader
  run.ts        Uniform encrypt/decrypt/break dispatch
  solver.worker.ts  Substitution hill-climb (Web Worker)
public/         quadgrams.bin
legacy/         The original CS641 Python solvers
scripts/        Quadgram corpus builder

License

MIT — see LICENSE.

About

Interactive cryptanalysis workbench — break and build classical ciphers (Caesar to DES & RSA) in your browser, with frequency analysis, auto-detection and a quadgram solver. Runs 100% client-side.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages