static void Main(string[] args) { var cipher = new VigenereCipher(" АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ-.?!0123456789"); string path = @"D:\GERASKIN\Vigenere\text.txt"; var inputText = ""; try { using (StreamReader sr = new StreamReader(path)) { inputText = sr.ReadToEnd().ToUpper(); } } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Text: " + inputText); Console.Write("Enter Key: "); var password = Console.ReadLine().ToUpper(); var encryptedText = cipher.Encrypt(inputText, password); Console.WriteLine("Result of encryption {0}", encryptedText); Console.WriteLine("Result of decryption {0}", cipher.Decrypt(encryptedText, password)); Console.ReadLine(); }
static void Main(string[] args) { var cipher = new VigenereCipher(); Console.WriteLine("Введите текст: "); var inputText = Console.ReadLine().ToUpper(); Console.WriteLine("Введите ключ: "); var password = Console.ReadLine().ToUpper(); var encryptedText = cipher.Encrypt(inputText, password); Console.WriteLine("Зашифрованное сообщение: {0}", encryptedText); Console.WriteLine("Расшифрованное сообщение: {0}", cipher.Decrypt(encryptedText, password)); Console.ReadLine(); }
public static void Test() { Console.WriteLine("Key: "); string key = Console.ReadLine(); Console.WriteLine(); Console.WriteLine("Text to cypher: "); string input = Console.ReadLine(); Console.WriteLine(); Console.WriteLine("Encrypted text:"); Console.WriteLine(VigenereCipher.Encrypt(input, key)); Console.WriteLine(); Console.WriteLine("Decrypted text:"); Console.WriteLine(VigenereCipher.Decrypt(input, key)); }
private void ButtonClickEncrypt(object sender, RoutedEventArgs e) { encryptedText.Text = cipher.Encrypt(inputText.Text.ToUpper(), password.Text.ToUpper()); }