Asper Header  1.0.14
The header injector extension
Loading...
Searching...
No Matches
vic.ts
Go to the documentation of this file.
1
12import { BaseCipher } from "../base/baseCipher";
13import { ColumnarCipher } from "./columnar";
14import { VigenereCipher } from "./vigenere";
15
23export class VICCipher extends BaseCipher {
27 readonly CipherName = "VIC";
28
34 super();
35 }
36
45 encode(plaintext: string, key: string): string {
46 const columnar = new ColumnarCipher();
47 const vigenere = new VigenereCipher();
48
49 const sanitized = this.sanitize(plaintext);
50 const transposed = columnar.encode(sanitized, key);
51 return vigenere.encode(transposed, key);
52 }
53
62 decode(ciphertext: string, key: string): string {
63 const columnar = new ColumnarCipher();
64 const vigenere = new VigenereCipher();
65
66 const intermediate = vigenere.decode(ciphertext, key);
67 return columnar.decode(intermediate, key);
68 }
69}
Abstract base class providing common functionality for cipher implementations.
Definition baseCipher.ts:18
Implementation of the Columnar Transposition cipher.
Definition columnar.ts:21
Simplified implementation of the VIC (Soviet spy) cipher.
Definition vic.ts:23
readonly CipherName
Identifier name for this cipher.
Definition vic.ts:27
constructor()
Constructor for simplified VIC cipher.
Definition vic.ts:33
Implementation of the Vigenère polyalphabetic substitution cipher.
Definition vigenere.ts:22
ColumnarCipher from columnar
Definition index.ts:42
VigenereCipher from vigenere
Definition index.ts:32
VigenereCipher
Definition index.ts:23
export const Record< string,(...args:any[])=> string