Asper Header  1.0.14
The header injector extension
Loading...
Searching...
No Matches
EnigmaCipher Class Reference

Simplified implementation of the Enigma machine polyalphabetic cipher. More...

Inheritance diagram for EnigmaCipher:
Inheritance graph
Collaboration diagram for EnigmaCipher:
Collaboration graph

Public Member Functions

 constructor (rotors:string[]=["EKMFLGDQVZNTOWYHXUSPAIBRCJ", "AJDKSIRUXBLHWTMCQGZNPYFVOE", "BDFHJLCPRTXVZNYEIWGAKMUSQO"], reflector:string="YRUHQSLDPXNGOKMIEBFZCWVJAT")
 Constructor for Enigma cipher.
 

Data Fields

readonly CipherName = "Enigma"
 Identifier name for this cipher.
 
rotors : string[]
 Array of rotor substitution alphabets.
 
reflector : string
 Reflector alphabet for the return path.
 
positions : number[]
 Current positions of each rotor (0-25)
 
- Data Fields inherited from BaseCipher
abstract abstract encode(plaintext:string, key?:any) abstract decode(ciphertext:string, key?:any) readonly CipherName: string
 Abstract method to encode plaintext.
 

Additional Inherited Members

- Static Public Attributes inherited from BaseCipher
static readonly ALPHABET: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 Standard English alphabet for cipher operations.
 

Detailed Description

Simplified implementation of the Enigma machine polyalphabetic cipher.

Simulates the Enigma's rotor mechanism where each keypress advances the rotors, creating a different substitution alphabet for each character. Uses multiple rotors with stepping mechanism and a reflector.

Definition at line 22 of file enigma.ts.

Member Function Documentation

◆ constructor()

EnigmaCipher::constructor ( rotors:string[] = [ "EKMFLGDQVZNTOWYHXUSPAIBRCJ", "AJDKSIRUXBLHWTMCQGZNPYFVOE", "BDFHJLCPRTXVZNYEIWGAKMUSQO" ],
reflector:string = "YRUHQSLDPXNGOKMIEBFZCWVJAT" )
inline

Constructor for Enigma cipher.

Parameters
rotorsArray of rotor substitution alphabets (default: 3 historical rotors)
reflectorReflector substitution alphabet (default: historical reflector B)

Initializes the Enigma machine with specified rotors and reflector. All rotors start at position 0.

Definition at line 53 of file enigma.ts.

Field Documentation

◆ __pad0__

rotors EnigmaCipher::__pad0__

Array of rotor substitution alphabets.

Each rotor defines a substitution alphabet that rotates with each use

Definition at line 32 of file enigma.ts.

◆ __pad1__

reflector EnigmaCipher::__pad1__

Reflector alphabet for the return path.

The reflector ensures that encryption and decryption are symmetric

Definition at line 38 of file enigma.ts.

◆ __pad2__

positions EnigmaCipher::__pad2__

Current positions of each rotor (0-25)

Tracks the rotation state of each rotor for proper stepping

Definition at line 44 of file enigma.ts.

◆ CipherName

readonly EnigmaCipher::CipherName = "Enigma"

Identifier name for this cipher.

Definition at line 26 of file enigma.ts.


The documentation for this class was generated from the following file: