// CheckHash is like ComparePasswordAndHash, except it also returns the params that the hash was
// created with. This can be useful if you want to update your hash params over time (which you
// should).
CheckHash is like ComparePasswordAndHash, except it also returns the params that the hash was
created with. This can be useful if you want to update your hash params over time (which you
should).
// CheckHash is like ComparePasswordAndHash except it also returns the params that the hash was // created with . This can be useful if you want to update your hash params over time ( which you // should ) .
func CheckHash(password, hash string) (match bool, params *Params, err error) {
	params, salt, key, err := DecodeHash(hash)
	if err != nil {
		return false, nil, err
	}
	otherKey := argon2.IDKey([]byte(password), salt, params.Iterations, params.Memory, params.Parallelism, params.KeyLength)
	keyLen := int32(len(key))
	otherKeyLen := int32(len(otherKey))
	if subtle.ConstantTimeEq(keyLen, otherKeyLen) == 0 {
		return false, params, nil
	}
	if subtle.ConstantTimeCompare(key, otherKey) == 1 {
		return true, params, nil
	}
	return false, params, nil
}
func CheckHash ( password , hash string ) ( match bool , params * Params , err error ) { params , salt , key , err := DecodeHash ( hash ) if err != nil { return false , nil , err } otherKey := argon2 . IDKey ( [ ] byte ( password ) , salt , params . Iterations , params . Memory , params . Parallelism , params . KeyLength ) keyLen := int32 ( len ( key ) ) otherKeyLen := int32 ( len ( otherKey ) ) if subtle . ConstantTimeEq ( keyLen , otherKeyLen ) == 0 { return false , params , nil } if subtle . ConstantTimeCompare ( key , otherKey ) == 1 { return true , params , nil } return false , params , nil }
CheckHash is like ComparePasswordAndHash, except it also returns the params that the hash was
created with.
CheckHash is like ComparePasswordAndHash except it also returns the params that the hash was created with .