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);
        }
        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);
        }
        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));
        }
        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));
        }
示例#5
0
 public AuthenticationMessageHandler(ILogger <AuthenticationMessageHandler> logger,
                                     IAuthenticationSynchronizationContextService authenticationSynchronizationContextService,
                                     IUnitOfWorkFactory unitOfWorkFactory,
                                     ISecureHashProvider secureHashProvider,
                                     ICharacterEquipmentBuilder characterEquipmentBuilder)
 {
     _logger = logger;
     _authenticationSynchronizationContextService = authenticationSynchronizationContextService;
     _unitOfWorkFactory         = unitOfWorkFactory;
     _secureHashProvider        = secureHashProvider;
     _characterEquipmentBuilder = characterEquipmentBuilder;
 }
示例#6
0
 public PasswordHasher(ISecureHashProvider secureHashProvider)
 {
     _secureHashProvider = secureHashProvider;
 }
示例#7
0
 public LoginSeed(ISecureHashProvider secureHashProvider)
 {
     _secureHashProvider = secureHashProvider;
 }