]> Cypherpunks repositories - gostls13.git/commit
runtime: use some startup randomness in the fallback hashes
authorKeith Randall <khr@golang.org>
Tue, 6 Jan 2015 17:06:44 +0000 (09:06 -0800)
committerKeith Randall <khr@golang.org>
Wed, 7 Jan 2015 16:02:05 +0000 (16:02 +0000)
commitce5cb037d171273f1a5294723234be5495c9d336
tree76005ac2875ec6f39ed9aad62ab069162eb65853
parent31775c5a958e00411954724408d1a069df4b9061
runtime: use some startup randomness in the fallback hashes

Fold in some startup randomness to make the hash vary across
different runs.  This helps prevent attackers from choosing
keys that all map to the same bucket.

Also, reorganize the hash a bit.  Move the *m1 multiply to after
the xor of the current hash and the message.  For hash quality
it doesn't really matter, but for DDOS resistance it helps a lot
(any processing done to the message before it is merged with the
random seed is useless, as it is easily inverted by an attacker).

Update #9365

Change-Id: Ib19968168e1bbc541d1d28be2701bb83e53f1e24
Reviewed-on: https://go-review.googlesource.com/2344
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/alg.go
src/runtime/hash32.go
src/runtime/hash64.go