Ejemplo n.º 1
0
        public void SameStringsGenerateSameHashesTest(ICipher cipher)
        {
            var stringEqual1   = "Check if this long string will be equal! 1234567890";
            var stringNotEqual = "Check if this long string will be equal! 1234576890";
            var stringEqual2   = "Check if this long string will be equal! 1234567890";

            var hashEqual1   = cipher.CalculateHash(stringEqual1);
            var hashEqual2   = cipher.CalculateHash(stringEqual2);
            var hashNotEqual = cipher.CalculateHash(stringNotEqual);

            Assert.True(hashEqual1 == hashEqual2);
            Assert.False(hashEqual1 == hashNotEqual);
        }
Ejemplo n.º 2
0
        public void Store(string title, string password, string superPassword)
        {
            var sign           = cipher.CalculateHash(superPassword);
            var cipherPassword = cipher.Encrypt(password, superPassword);

            var record = new VaultRecord
            {
                Title          = title,
                CipherPassword = cipherPassword,
                Sign           = sign
            };

            vault.Store(record);
        }