enigma-cipher 0.1.1

An absurdly fast and highly flexible Enigma machine simulation, encryption, and decryption library.
Documentation
  • Coverage
  • 58.33%
    7 out of 12 items documented2 out of 10 items with examples
  • Size
  • Source code size: 25.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.82 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vi013t

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