Академический Документы
Профессиональный Документы
Культура Документы
2181121
Мухаррямов Н.Н.
Лабораторная работа №1
Цель работы: освоить метод шифрования перестановочным шифром
1
1
2
2
namespace HorizontalPlaceChangingCipher
{
class Program
{
static void Main(string[] args)
{
Console.BackgroundColor = (System.ConsoleColor)15;
Console.ForegroundColor = 0;
Console.Clear();
//Этап ввода сообщения и ключа зашифровки
Console.WriteLine("Введите сообщение для зашифровки");
string msgFirst = Console.ReadLine();
Console.WriteLine("Введите ключ");
string key = Console.ReadLine();
char[,] indexedkey = new char[2, key.Length];
//удаление пробелов
string msg = "";
for (int i = 0; i < msgFirst.Length; i++)
{
if (msgFirst[i]!=' ')
{
msg=msg+msgFirst[i];
}
Console.WriteLine();
//Шифрование
Console.WriteLine();
Console.WriteLine();
//Дешифрование
Console.WriteLine();
Console.ReadLine();
}
}
}
Рисунок 3 – выполнение программы.