mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-12 16:26:37 +00:00
parent
3d75819cdb
commit
d985aa9e4b
@ -108,9 +108,9 @@ func Blocks(ctx context.Context, r io.Reader, blocksize int, sizehint int64, cou
|
|||||||
return blocks, nil
|
return blocks, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate quickly validates buf against the cryptohash hash (if len(hash)>0)
|
// Validate quickly validates buf against the 32-bit weakHash, if not zero,
|
||||||
// and the 32-bit hash weakHash (if not zero). It is satisfied if either hash
|
// else against the cryptohash hash, if len(hash)>0.
|
||||||
// matches, or neither is given.
|
// It is satisfied if neither hash is given.
|
||||||
func Validate(buf, hash []byte, weakHash uint32) bool {
|
func Validate(buf, hash []byte, weakHash uint32) bool {
|
||||||
if weakHash != 0 {
|
if weakHash != 0 {
|
||||||
return adler32.Checksum(buf) == weakHash
|
return adler32.Checksum(buf) == weakHash
|
||||||
|
Loading…
Reference in New Issue
Block a user