Exemple #1
0
        public void AESRoundTripTest()
        {
            string orig     = "I like to eat pizza all day long!";
            string password = "******";
            string hash     = PasswordHash.HashPassword(password);

            byte[] key       = PasswordHash.GetDecryptedKey(password, hash);
            byte[] encrypted = AES.AESEncrypt(Encoding.ASCII.GetBytes(orig), key, key, 16);
            string decrypted = Encoding.ASCII.GetString(AES.AESDecrypt(encrypted, key, key, 16));

            Assert.AreEqual(orig, decrypted);
        }