25 private shift: number;
50 encode(plainText:
string =
""):
string {
51 const output:
string[] = [];
53 for (
const ch of plainText) {
60 const cipherIndex = this.mod(index + this.shift, 26);
64 return output.join(
"");
75 decode(cipherText:
string =
""):
string {
76 const output:
string[] = [];
78 for (
const ch of cipherText) {
85 const plainIndex = this.mod(index - this.shift, 26);
89 return output.join(
"");
Abstract base class providing common functionality for cipher implementations.
static readonly ALPHABET
Standard English alphabet for cipher operations.
Implementation of the Caesar substitution cipher.
constructor(shift:number=3)
Constructor for Caesar cipher.
readonly CipherName
Identifier name for this cipher.
export const Record< string,(...args:any[])=> string