예제 #1
0
        public void PasswordEncryptionTest()
        {
            string            data      = "monkey";
            PasswordEncrypted encrypted = new PasswordEncrypted(data, "password");

            OutLine(encrypted);

            PasswordDecrypted decrypted = new PasswordDecrypted(encrypted, "password");

            OutLine(decrypted);

            Expect.AreEqual(decrypted.Data, data);
        }
예제 #2
0
        public void AesCipherTest()
        {
            string            data     = "Banana";
            string            password = "******";
            PasswordEncrypted aes      = new PasswordEncrypted(data, password);

            PasswordDecrypted aes2 = new PasswordDecrypted(aes.Value, password);

            Expect.AreEqual(data, aes2.Value);

            PasswordDecrypted aes3 = new PasswordDecrypted(aes, password);

            Expect.AreEqual(data, aes3.Value);
        }
예제 #3
0
        public void CipherShouldntBeTheSame()
        {
            string            data     = "data".RandomLetters(16);
            string            password = "******";
            PasswordEncrypted enc      = new PasswordEncrypted(data, password);
            PasswordEncrypted enc2     = new PasswordEncrypted(data, password);

            Expect.IsFalse(enc.Value.Equals(enc2.Value));
            Expect.IsFalse(enc.Value == enc2.Value);

            PasswordDecrypted dec  = new PasswordDecrypted(enc, password);
            PasswordDecrypted dec2 = new PasswordDecrypted(enc2, password);

            Expect.AreEqual(dec.Value, dec2.Value);
        }