Struct ultra::Enigma [] [src]

pub struct Enigma { /* fields omitted */ }

Methods

impl Enigma
[src]

Creates a new Enigma, where rotors is a string of three digits ranging from 1-8 (corresponding to rotors I through VIII of the real Enigma machine), keys and rings are three character strings containing the key and ring settings, reflector is one of 'A', 'B', or 'C', and plugboard is a string of whitespace-delimited pairs of characters.

Examples

Enigma with rotors I, II, and III, key setting ABC, ring setting DEF, reflector B, and a plugboard connection between 'P' and 'Y'.

use ultra::Enigma;

let mut enigma = Enigma::new("123", "ABC", "DEF", 'B', "PY");
println!("{}", enigma.encrypt("ENIGMA"));

Encrypts an entire message, advancing the rotors of the machine after each alphabetic character is encrypted.

Advances the rotors then returns the substitution of a character, if the input character was alphabetic.

Resets the Enigma to its initial state.

Trait Implementations

impl Clone for Enigma
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Enigma
[src]

Formats the value using the given formatter.