Расшифровка закрытого текста с помощью частотного анализаHtml

Программисты Html
Ответить
Anonymous
 Расшифровка закрытого текста с помощью частотного анализа

Сообщение Anonymous »

0
У меня есть зашифрованный текст. Я разделил его на диады, чтобы получить цифры для частотного анализа. Я написал html-программу, которая подсчитывала количество цифр и их частоту и сравнивала их с частотой букв в русском языке. Я приложу зашифрованный текст и код непосредственно ниже. проблема в том, что при подстановке по рассчитанной частоте получается несвязанный текст. Прошу помочь всех, кто это понимает. предположительно текст должен быть из серии книг о Незнайке.
Вот шифртекст: 81 69 83 90 69 83 88 17 54 83 88 45 17 82 69 66 35 82 69 87 17 11 70 17 69 75 93 35 69 87 21 57 83 79 30 87 35 21 88 54 35 82 69 87 83 87 35 93 83 54 57 17 55 57 17 57 79 83 93 83 11 83 12 64 35 45 35 53 35 87 83 57 21 82 54 21 45 35 58 17 55 57 17 57 82 69 83 45 83 64 35 54 83 12 58 35 82 93 21 87 11 17 82 69 45 17 11 17 93 17 83 69 82 54 83 35 12 87 35 30 57 93 99 64 35 82 69 21 21 35 29 35 53 83 93 75 66 35 83 69 69 83 38 83 81 69 83 87 35 53 42 93 17 87 21 64 35 87 29 21 87 83 12 87 21 11 35 54 83 81 57 83 12 54 66 57 83 93 35 54 82 35 35 29 35 83 53 40 83 11 21 93 83 82 75 87 83 83 87 17 88 17 57 83 87 81 21 93 17 30 81 35 53 30 21 87 21 57 69 83 57 17 88 17 93 83 82 75 87 35 21 79 35 93 87 21 79 17 93 35 12 66 35 38 83 58 45 35 11 82 69 17 54 93 35 87 21 55 83 35 35 53 30 11 30 29 35 79 83 69 35 70 82 83 53 21 45 17 93 82 55 83 69 58 45 17 54 21 69 75 35 35 87 17 82 93 35 11 30 99 29 30 99 88 21 79 30 54 58 17 45 21 64 87 83 90 69 83 35 12 82 83 54 35 45 66 35 87 87 83 87 35 30 93 42 53 17 93 83 82 75 58 45 17 54 11 17 21 69 83 81 69 83 35 12 53 83 93 75 66 35 40 83 69 35 93 83 82 75 83 82 69 17 54 17 69 75 82 55 11 83 79 17 83 87 17 83 82 83 88 87 17 93 17 90 69 83 87 35 11 17 54 87 83 87 83 81 35 69 57 83 83 87 17 87 35 87 17 54 21 11 35 93 17 17 45 93 35 87 30
вот html-файл:
введите здесь описание изображения



Russian alphabet (by frequency)











Frequency of dyads in the text




DYAD




QUANTITY




REPLACEMENT





Decryption result:



Reset all replacements
Enter the letters in the "REPLACEMENT" fields for substitution>





// Your ciphertext (dyads)
const encryptedText = "81 69 83 90 69 83 88 17 54 83 88 45 17 82 69 66 35 82 69 87 17 11 70 17 69 75 93 35 69 87 21 57 83 79 30 87 35 21 88 54 35 82 69 87 83 87 35 93 83 54 57 17 55 57 17 57 79 83 93 83 11 83 12 64 35 45 35 53 35 87 83 57 21 82 54 21 45 35 58 17 55 57 17 57 82 69 83 45 83 64 35 54 83 12 58 35 82 93 21 87 11 17 82 69 45 17 11 17 93 17 83 69 82 54 83 35 12 87 35 30 57 93 99 64 35 82 69 21 21 35 29 35 53 83 93 75 66 35 83 69 69 83 38 83 81 69 83 87 35 53 42 93 17 87 21 64 35 87 29 21 87 83 12 87 21 11 35 54 83 81 57 83 12 54 66 57 83 93 35 54 82 35 35 29 35 83 53 40 83 11 21 93 83 82 75 87 83 83 87 17 88 17 57 83 87 81 21 93 17 30 81 35 53 30 21 87 21 57 69 83 57 17 88 17 93 83 82 75 87 35 21 79 35 93 87 21 79 17 93 35 12 66 35 38 83 58 45 35 11 82 69 17 54 93 35 87 21 55 83 35 35 53 30 11 30 29 35 79 83 69 35 70 82 83 53 21 45 17 93 82 55 83 69 58 45 17 54 21 69 75 35 35 87 17 82 93 35 11 30 99 29 30 99 88 21 79 30 54 58 17 45 21 64 87 83 90 69 83 35 12 82 83 54 35 45 66 35 87 87 83 87 35 30 93 42 53 17 93 83 82 75 58 45 17 54 11 17 21 69 83 81 69 83 35 12 53 83 93 75 66 35 40 83 69 35 93 83 82 75 83 82 69 17 54 17 69 75 82 55 11 83 79 17 83 87 17 83 82 83 88 87 17 93 17 90 69 83 87 35 11 17 54 87 83 87 83 81 35 69 57 83 83 87 17 87 35 87 17 54 21 11 35 93 17 17 45 93 35 87 30";

// Russian alphabet in descending order of frequency
const russianAlphabet = [
'o', 'e', 'a', 'I', 'n', 't', 's', 'r', 'v', 'l',
'k', 'm', 'd', 'p', 'y', 'I', 's', 'b', 'g', 'z',
'b', 'h', 'y', 'x', 'w', 'y', 'c', 'sch', 'e',
'f', 'b'
];

// Using your frequency table (dyads are sorted in descending order of frequency)
const frequencyData = [
{diad: '83', count: 57},
{diad: '35', count: 50},
{diad: '17', count: 38},
{diad: '87', count: 34},
{diad: '69', count: 27},
{diad: '93', count: 24},
{diad: '21', count: 23},
{diad: '82', count: 22},
{diad: '54', count: 17},
{diad: '57', count: 14},
{diad: '11', count: 13},
{diad: '45', count: 12},
{diad: '30', count: 11},
{diad: '53', count: 9},
{diad: '75', count: 9},
{diad: '12', count: 8},
{diad: '79', count: 7},
{diad: '81', count: 7},
{diad: '88', count: 7},
{diad: '58', count: 6},
{diad: '66', count: 6},
{diad: '29', count: 5},
{diad: '55', count: 5},
{diad: '64', count: 5},
{diad: '90', count: 3},
{diad: '99', count: 3},
{diad: '38', count: 2},
{diad: '40', count: 2},
{diad: '42', count: 2},
{diad: '70', count: 2}
];

// Displaying the source text
$("#code").text(encryptedText);

// Filling in the Russian alphabet table
russianAlphabet.forEach(function(letter, index) {
$(`${letter}`).appendTo("#letters");
$(`${index + 1}`).appendTo("#freq-order");
});

// Filling in the horizontal frequency table
let diadsHeaderHtml = '';
let countsHtml = '';
let inputsHtml = '';

frequencyData.forEach(function(item, index) {
diadsHeaderHtml += `${item.diad}`;
countsHtml += `${item.count}`;
inputsHtml += `



`;
});

$("#diads-header").html(diadsHeaderHtml);
$("#counts").html(countsHtml);
$("#inputs").html(inputsHtml);

// Function for applying substitutions
function applySubstitutions() {
let result = encryptedText;

// Resetting the backlight
$("#letters td").removeClass('active');

// We apply all the entered substitutions
$(".substitution-input").each(function() {
const diad = $(this).data('diad');
const letter = $(this).val().toLowerCase();

if (letter && /[a-ze]/.test(letter)) {
// Replacing all occurrences of the dyad
const regex = new RegExp(diad, 'g');
result = result.replace(regex, `${letter}`);

// Highlighting the letter used in the alphabet
$('#letters td').each(function() {
if ($(this).text() === letter) {
$(this).addClass('active');
}
});
}
});

// Displaying the result
$("#code").html(result);
}

// Handler for entering substitutions into fields
$(document).on('keyup', '.substitution-input', function() {
applySubstitutions();
});

// Reset button
$("#reset-btn").click(function() {
$(".substitution-input").val('');
applySubstitutions();
});

// Initialization at boot
$(document).ready(function() {
applySubstitutions();
});



Подробнее здесь: https://stackoverflow.com/questions/798 ... y-analysis
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Html»