/// <summary> /// Compare a Password to the Secured Hash /// /// Uses the PBKDF2 Hashing algorithm /// </summary> /// <param name="password">Password that should be compared to the Hash</param> /// <returns>True if the Password matches the Hash, false otherwise</returns> public bool Verify(IPassword password) { if (password == null) { throw new ArgumentNullException(nameof(password)); } var b = Utils.Secure.Encode(Hash); var intertions = BitConverter.ToInt32(Utils.Secure.Encode(Hash), 0); var hasher = new Hash.PBKDF2(password.Plaintext, intertions); return(hasher.Verify(Hash)); }
private SecuredPassword Hash() { var hasher = new Hash.PBKDF2(Plaintext, iterations); return(new SecuredPassword(hasher.Hash())); }