Пример #1
0
        public void TestIsValid()
        {
            var encoder = new ScryptEncoder();

            Assert.False(encoder.IsValid("$e1$adasdasd$asdasdsd"));
            Assert.True(encoder.IsValid(encoder.Encode("MyPassword")));
        }
Пример #2
0
        public bool Check(string senha, string hash)
        {
            ScryptEncoder s = new ScryptEncoder();

            if (!s.IsValid(hash))
            {
                return(false);
            }

            return(s.Compare(senha, hash));
        }
Пример #3
0
            public bool IsValid(string hash)
            {
                ScryptEncoder scrypt = new ScryptEncoder(65536, 8, 1, ISecureRandomProvider.rngCryptoService);

                return(scrypt.IsValid(hash));
            }
Пример #4
0
 /// <summary>
 /// Compares a plain value against a hashed value.
 /// </summary>
 /// <param name="plainValue">The plain string to compare</param>
 /// <param name="hashedValue">The hashed string to compare</param>
 /// <returns>True if the plain string when hashed matches the hashed string, otherwise false</returns>
 public bool CompareHash(string plainValue, string hashedValue) =>
 _encoder.IsValid(hashedValue) && _encoder.Compare(plainValue, hashedValue);