mirror of
https://github.com/golang/go
synced 2024-11-26 04:07:59 -07:00
runtime: init plan9 hashkey by time
Maphash requires non-zero integer for initial hashkey Fixes #45090 Change-Id: Ie567f648c19e81cddc8e72a1c64809fbf52df188 Reviewed-on: https://go-review.googlesource.com/c/go/+/303969 Trust: Meng Zhuo <mzh@golangcn.org> Run-TryBot: Meng Zhuo <mzh@golangcn.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Richard Miller <millerresearch@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
06ad41642c
commit
a95454b6f3
@ -325,7 +325,23 @@ func crash() {
|
||||
|
||||
//go:nosplit
|
||||
func getRandomData(r []byte) {
|
||||
extendRandom(r, 0)
|
||||
// inspired by wyrand see hash32.go for detail
|
||||
t := nanotime()
|
||||
v := getg().m.procid ^ uint64(t)
|
||||
|
||||
for len(r) > 0 {
|
||||
v ^= 0xa0761d6478bd642f
|
||||
v *= 0xe7037ed1a0b428db
|
||||
size := 8
|
||||
if len(r) < 8 {
|
||||
size = len(r)
|
||||
}
|
||||
for i := 0; i < size; i++ {
|
||||
r[i] = byte(v >> (8 * i))
|
||||
}
|
||||
r = r[size:]
|
||||
v = v>>32 | v<<32
|
||||
}
|
||||
}
|
||||
|
||||
func initsig(preinit bool) {
|
||||
|
Loading…
Reference in New Issue
Block a user