26 private readonly a: number;
31 private readonly b: number;
50 if (this.gcd(this.a, 26) !== 1) {
51 throw new Error(
"a must be coprime with 26");
62 private gcd(a: number, b: number): number {
63 return b === 0 ? a : this.gcd(b, a % b);
73 encode(plainText:
string =
""):
string {
95 decode(cipherText:
string =
""):
string {
96 const invA = this.modInverse(this.a, 26);
Implementation of the Affine substitution cipher.
constructor(a:number=5, b:number=8)
Constructor for Affine cipher.
readonly CipherName
Identifier name for this cipher.
Abstract base class providing common functionality for cipher implementations.
static readonly ALPHABET
Standard English alphabet for cipher operations.
export const Record< string,(...args:any[])=> string