File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -297,13 +297,14 @@ func (bl *Bloom) AddIfNotHasTS(entry []byte) (added bool) {
297297// Typical usage with a go-cid CID and go-multihash:
298298//
299299// dm, _ := multihash.Decode(c.Hash())
300- // if dm.Code != multihash.IDENTITY && len(dm.Digest) >= 16 {
301- // h1, h2 := bbloom.SplitDigest(dm.Digest)
302- // bf.AddHashed(h1, h2)
303- // }
300+ // h1, h2 := bbloom.SplitDigest(dm.Digest)
301+ // bf.AddHashed(h1, h2)
304302//
305- // Identity multihashes (code 0x00) contain raw data, not a crypto digest,
306- // and must fall back to the SipHash path ([Bloom.Add]).
303+ // Digests from different hash functions (SHA2-256, BLAKE2b-256, etc.) can
304+ // be mixed freely in the same filter -- each produces uniform, independent
305+ // bytes. Identity multihashes (code 0x00) and digests shorter than 16
306+ // bytes cannot use this path; use a separate [Bloom] with [Bloom.Add]
307+ // for those.
307308func SplitDigest (digest []byte ) (h1 , h2 uint64 ) {
308309 _ = digest [15 ] // bounds check hint
309310 h1 = binary .LittleEndian .Uint64 (digest [:8 ])
You can’t perform that action at this time.
0 commit comments