enigma-cracker

Crates.ioenigma-cracker
lib.rsenigma-cracker
version0.1.0
sourcesrc
created_at2024-10-08 03:42:45.448803
updated_at2024-10-08 03:42:45.448803
descriptionA start-from-nothing Enigma cipher decryption library for Rust.
homepage
repository
max_upload_size
id1400751
size10,907
Violet (vi013t)

documentation

README

enigma-cracker

A start-from-nothing Enigma cipher decryption library for Rust.

enigma-cracker finds the most likely rotor settings, ring settings, and plugboard by brute forcing them one at a time and performing various cryptographic analysis techniques on the results.

Naturally, the crate can't perfectly identify the "correct" plaintext, so it relies on statistics like index of coincidence; Thus, it'll be more accurate with longer ciphertexts.

Usage

cargo add enigma-cracker
use enigma_cracker::crack_enigma;

fn main() -> EnigmaResult<()> {

	let ciphertext = include_str!("cipher_file.txt");
	let plaintext = crack_enigma(ciphertext);

	Ok(())
}
cargo run --release

Performance

The performance of this crate varies wildly by ciphertext length; Since Enigma machines decrypt character by character, the decryption process is O(n). This crate needs to perform several million decryptions, so longer ciphertexts can drastically increase runtime.

Make sure you run in release mode; The difference between debug and release mode can be over 10x in speed.

I also recommend using cargo-wizard to optimize your release profile for maximum runtime performance.

Commit count: 0

cargo fmt