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);