enigma-cipher

Crates.ioenigma-cipher
lib.rsenigma-cipher
version0.1.1
sourcesrc
created_at2024-10-05 05:51:58.863058
updated_at2024-10-05 05:54:22.32141
descriptionAn absurdly fast and highly flexible Enigma machine simulation, encryption, and decryption library.
homepage
repository
max_upload_size
id1397418
size23,651
Violet (vi013t)

documentation

README

enigma-rs

An absurdly fast and highly flexible Enigma machine simulation, encryption, and decryption library for Rust.

Usage

cargo add enigma-cipher

Example Usage:

use enigma_cipher::{EnigmaMachine, EnigmaResult, EnigmaBuilder as _};

pub fn main() -> EnigmaResult<()> {
	let machine = EnigmaMachine::new()
		.reflector("B")
		.plugboard("BY EW FZ GI QM RV UX")
		.rotors(1, 2, 3)
		.ring_settings(10, 12, 14)
		.ring_positions(5, 22, 3)?;
	let plaintext = machine.decode("KDZVKMNTYQJPHFXI");
	println!("{plaintext}");
}
cargo run --release

Performance

This crate uses a number of optimization techniques for max performance, including:

  • Memoization of certain functions that are called whenever an Enigma machine is created
  • Maximum runtime release profile applied by cargo-wizard
  • String storage as &[u8] for rapid indexing
Commit count: 0

cargo fmt