Kryptos K1-style Vigenere solver using beam search, chi-squared, IoC, and bigram scoring. Adopted from https://github.com/chillhackr/kryptos
npm install kryptos-solverbash
npm install kryptos-solver
`
kryptos-solver
A cryptographic toolset in development for analyzing and solving Jim Sanborn's Kryptos sculpture. Ported from the Go logic, this package uses various techniques to recover keys without prior knowledge, targeted at solving KRYPTOS with as limited knowledge as possible.
🚀 Installation
#### The Workflow
This package includes a run-me.js script to help you get started immediately.
`bash
node run-me.js
`
Basic Usage
`javaScript
import { K1Solver } from 'kryptos-solver';
const solver = new K1Solver();
const k1cipher = "EMUFPHZLRFAXYUSDJKZLDKRNSHGNFIVJYQTQUXQBQVYUVLLTREVJYQTMKYRDMFD";
// solve(ciphertext, minKeyLen, maxKeyLen, beamWidth, frozenPositions)
const results = solver.solve(k1cipher, 8, 8, 10000);
console.log(Top Key: ${results[0].key});
console.log(Decrypted: ${results[0].plaintext});
`
Poking from the Unknown:
kryptos-solver doesn't just decrypt; it analyzes.
1. Statistical Scoring
The solver evaluates candidates using:
Chi-Squared Analysis: Measuring how closely a decryption matches English letter frequencies.
Index of Coincidence (IoC): Detecting the "burstiness" of the text to filter out noise.
Bigram Scoring: Checking for common English pairs like "TH", "HE", and "IN". (more should be considered)
2. Beam Search
Instead of brute-forcing trillions of combinations, we use a Beam Search algorithm. It keeps only the most promising key prefixes at each step, allowing you to tweak and analysis different key lengths.
3. Frozen Positions
If you suspect part of the key (e.g., the first two letters are "PA"), you can "freeze" them to drastically speed up the search:
`javaScript
//const frozen = { 0: 'P', 1: 'A' };
//solver.solve(ciphertext, 10, 10, 5000, frozen);
solver.solve(ciphertext, 10, 10, 5000); // run with default, no freezing
``