-
Notifications
You must be signed in to change notification settings - Fork 9.7k
/
vigenere-cipher.js
35 lines (33 loc) · 1 KB
/
vigenere-cipher.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { NotImplementedError } = require('../extensions/index.js');
/**
* Implement class VigenereCipheringMachine that allows us to create
* direct and reverse ciphering machines according to task description
*
* @example
*
* const directMachine = new VigenereCipheringMachine();
*
* const reverseMachine = new VigenereCipheringMachine(false);
*
* directMachine.encrypt('attack at dawn!', 'alphonse') => 'AEIHQX SX DLLU!'
*
* directMachine.decrypt('AEIHQX SX DLLU!', 'alphonse') => 'ATTACK AT DAWN!'
*
* reverseMachine.encrypt('attack at dawn!', 'alphonse') => '!ULLD XS XQHIEA'
*
* reverseMachine.decrypt('AEIHQX SX DLLU!', 'alphonse') => '!NWAD TA KCATTA'
*
*/
class VigenereCipheringMachine {
encrypt() {
throw new NotImplementedError('Not implemented');
// remove line with error and write your code here
}
decrypt() {
throw new NotImplementedError('Not implemented');
// remove line with error and write your code here
}
}
module.exports = {
VigenereCipheringMachine
};