]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14] 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>
Mon, 24 Feb 2020 15:47:07 +0000 (15:47 +0000)
commit17acbdb3571b9720dac8eb71f4df385e16c8c91e
treee7cda64a52a8d97e626c669c250551304e83bafd
parentbabeec29aa61b715e3ec529c5ec12475d3554f21
[release-branch.go1.14] 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.

Updates #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>
(cherry picked from commit 638df87fa4f927763f99ebf0c6bc9c4a5380d1f9)
Reviewed-on: https://go-review.googlesource.com/c/go/+/220617
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
src/hash/maphash/maphash.go
src/hash/maphash/maphash_test.go