Crates.io | enigma-cracker |
lib.rs | enigma-cracker |
version | 0.1.0 |
source | src |
created_at | 2024-10-08 03:42:45.448803 |
updated_at | 2024-10-08 03:42:45.448803 |
description | A start-from-nothing Enigma cipher decryption library for Rust. |
homepage | |
repository | |
max_upload_size | |
id | 1400751 |
size | 10,907 |
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.
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
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.