示例#1
0
文件: Program.cs 项目: mael0r/crypto
        private void Test(Options options)
        {
            string password = "******";

            try
            {
                Console.Write($"Encoding/Decoding [{options.TestFilename}]...");
                byte[] plaintext  = File.ReadAllBytes(options.TestFilename);
                byte[] ciphertext = Crypto2.Encrypt(plaintext, password);
                byte[] utest      = Crypto2.Decrypt(ciphertext, password);
                Console.WriteLine(plaintext.SequenceEqual(utest) ? "Good" : "Failed!");
                Console.WriteLine($" Encypted: {plaintext.Length,10} characters");
                Console.WriteLine($"Decrypted: {ciphertext.Length,10} characters");
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed");
                Console.WriteLine($"Error: {e.Message}");
            }
        }