]> Cypherpunks repositories - gostls13.git/commit
hash/maphash: don't discard data on random seed init
authorvovapi <evgrafov.vladimir@gmail.com>
Thu, 20 Feb 2020 19:29:22 +0000 (19:29 +0000)
committerDmitri Shuralyov <dmitshur@golang.org>
Sat, 22 Feb 2020 15:25:30 +0000 (15:25 +0000)
commit638df87fa4f927763f99ebf0c6bc9c4a5380d1f9
tree3cf303448f64e72185ed607afcaf2209a4d1e808
parent7ee3b63c8bab7d1e6d3b8df21a465aecd2e08447
hash/maphash: don't discard data on random seed init

Hash initializes seed on the first usage of seed or state with initSeed.
initSeed uses SetSeed which discards accumulated data.
This causes hash to return different sums for the same data in the first use
and after reset.
This CL fixes this issue by separating the seed set from data discard.

Fixes #37315

Change-Id: Ic7020702c2ce822eb700af462e37efab12f72054
GitHub-Last-Rev: 48b2f963e86c1b37d49b838a050cc4128bb01266
GitHub-Pull-Request: golang/go#37328
Reviewed-on: https://go-review.googlesource.com/c/go/+/220259
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/hash/maphash/maphash.go
src/hash/maphash/maphash_test.go