예제 #1
0
파일: UnitTest1.cs 프로젝트: mzh99/MHCrypto
        public void CryptEqualLenKeyMsgIsSuccessful()
        {
            const string KEY1 = "ABCDABCDABCDABCDABCDABCDABCD";
            const string MSG1 = "CRYPTOISSHORTFORCRYPTOGRAPHY";

            string cipherText = Vigenere.EncryptASCII(MSG1, KEY1);

            Assert.AreEqual("CSASTPKVSIQUTGQUCSASTPIUAQJB", cipherText, $"Encrypt of {MSG1} failed");
            string plainText = Vigenere.DecryptASCII(cipherText, KEY1);

            Assert.AreEqual(MSG1, plainText, $"Decrypted message doesn't equal {MSG1}");
        }
예제 #2
0
파일: UnitTest1.cs 프로젝트: mzh99/MHCrypto
        public void CryptShortIsSuccessful()
        {
            const string KEY1 = "LEMON";
            const string MSG1 = "ATTACKATDAWN";

            string cipherText = Vigenere.EncryptASCII(MSG1, KEY1);

            Assert.AreEqual("LXFOPVEFRNHR", cipherText, $"Encrypt of {MSG1} failed");
            string plainText = Vigenere.DecryptASCII(cipherText, KEY1);

            Assert.AreEqual(MSG1, plainText, $"Decrypted message doesn't equal {MSG1}");
        }