31 private readonly map: Record<string, string>;
43 for (let i = 0; i < alphabet.length; i++) {
44 this.map[alphabet[i]] = alphabet[alphabet.length - 1 - i];
55 encode(plainText:
string =
""): string {
58 .map(ch => this.map[ch.toUpperCase()] ?? ch)
69 decode(cipherText:
string =
""):
string {
71 return this.encode(cipherText);
Implementation of the Atbash substitution cipher.
constructor()
Constructor for Atbash 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