コード例 #1
0
        public bool Same_input_produces_different_hash(ISecureHashProvider provider)
        {
            var bytes = Encoding.UTF8.GetBytes(Password);
            var left  = provider.Password(bytes);   // ARGON2 w/ built-in salt
            var right = provider.Password(bytes);

            return(!left.SequenceEqual(right));
        }
コード例 #2
0
        public bool Different_input_produces_different_hash(ISecureHashProvider provider)
        {
            var leftBytes  = Encoding.UTF8.GetBytes(Password);
            var rightBytes = Encoding.UTF8.GetBytes("rosebowl");

            var left  = provider.Password(leftBytes);
            var right = provider.Password(rightBytes);

            return(!left.SequenceEqual(right));
        }
コード例 #3
0
        public bool Invalid_hash_cannot_be_verified(ISecureHashProvider provider)
        {
            var hash   = provider.Password(Encoding.UTF8.GetBytes(Password));
            var result = provider.PasswordVerify(Encoding.UTF8.GetBytes("rosebowl"), hash);

            return(result == VerifyHashResult.Invalid);
        }
コード例 #4
0
        public bool Hash_can_be_verified(ISecureHashProvider provider)
        {
            var hash   = provider.Password(Encoding.UTF8.GetBytes(Password));
            var result = provider.PasswordVerify(Encoding.UTF8.GetBytes(Password), hash);

            return(result == VerifyHashResult.Valid);
        }