lib/scanner: Fix Validate docs (#6776)

Co-authored-by: greatroar <@>
This commit is contained in:
greatroar 2020-06-21 20:23:06 +02:00 committed by GitHub
parent 3d75819cdb
commit d985aa9e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,9 +108,9 @@ func Blocks(ctx context.Context, r io.Reader, blocksize int, sizehint int64, cou
return blocks, nil
}
// Validate quickly validates buf against the cryptohash hash (if len(hash)>0)
// and the 32-bit hash weakHash (if not zero). It is satisfied if either hash
// matches, or neither is given.
// Validate quickly validates buf against the 32-bit weakHash, if not zero,
// else against the cryptohash hash, if len(hash)>0.
// It is satisfied if neither hash is given.
func Validate(buf, hash []byte, weakHash uint32) bool {
if weakHash != 0 {
return adler32.Checksum(buf) == weakHash