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

Implementation of the Affine substitution cipher. More...

Inheritance diagram for AffineCipher:
Inheritance graph
Collaboration diagram for AffineCipher:
Collaboration graph

Public Member Functions

 constructor (a:number=5, b:number=8)
 Constructor for Affine cipher.
 

Data Fields

readonly CipherName = "Affine"
 Identifier name for this cipher.
 
- 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

Implementation of the Affine substitution cipher.

Uses linear mathematical transformation E(x) = (ax + b) mod 26 where 'a' is the multiplicative key (must be coprime to 26) and 'b' is the additive key. This provides more complexity than simple Caesar cipher.

Definition at line 22 of file affine.ts.

Member Function Documentation

◆ constructor()

AffineCipher::constructor ( a:number = 5,
b:number = 8 )
inline

Constructor for Affine cipher.

Parameters
aMultiplicative key (default: 5, must be coprime to 26)
bAdditive key (default: 8)
Exceptions
Errorif 'a' is not coprime to 26

Initializes the cipher with the given coefficients. The multiplicative coefficient 'a' must be coprime to 26 to ensure the cipher is reversible.

Definition at line 46 of file affine.ts.

Field Documentation

◆ CipherName

readonly AffineCipher::CipherName = "Affine"

Identifier name for this cipher.

Definition at line 36 of file affine.ts.


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