-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecoder_pro.js
25 lines (17 loc) · 997 Bytes
/
decoder_pro.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// A decryption program with shift
// Alphabet
var symbols = ['А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я', ' ', '.', ',', '—', '!'];
// Shift
var shift = 10;
// Encoded Message
var encodedMessage = [8, 28, 36, 52, 56, 40, 23, 31, 56, 39, 38, 28, 48, 52, 58, 56, 38, 27, 32, 37, 56, 40, 23, 31, 56, 39, 38, 41, 39, 32, 57];
// DecodedMessage
var decodedMessage = '';
for (var i = 0; i < encodedMessage.length; i++) {
var symbolIndex = encodedMessage[i];
var symbol = symbols[symbolIndex + 10];
if (symbolIndex + 10 > symbols.length) {
symbol = symbols[symbolIndex + 10 - symbols.length];
}
decodedMessage += symbol;
}