]> Cypherpunks.ru repositories - gostls13.git/commitdiff
hash/maphash: adjust package comment
authorRuss Cox <rsc@golang.org>
Fri, 18 Sep 2020 16:30:10 +0000 (12:30 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 12 Oct 2020 16:30:45 +0000 (16:30 +0000)
Add note about using per-use seeds.

Delete "collision-resistant but" in:
> The hash functions are collision-resistant but not cryptographically secure.

"Collision-resistant" has a precise cryptographic meaning that is
incompatible with "not cryptographically secure".
All that is really meant by it here here is "it's a good hash function",
which should be established already.

Also delete:
> The hash value of a given byte sequence is consistent within a
> single process, but will be different in different processes.

This was added for its final clause in response to #37040,
but "The hash value of a given byte sequence" is by design not a
concept in this package. Only "... of a given seed and byte sequence".
And seeds cannot be shared between processes, so again by design
you can't even set up the appropriate first half of the sentence
to say the second half.

Change-Id: I2c02bee0e804ef3b120cb4752bf89e60f3f5ff5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/255968
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/hash/maphash/maphash.go

index 071dc04b5489566720e0725ac631f541f4ff8a38..ecc147d5997b4a9d552c5ea9f91931e93410a242 100644 (file)
@@ -6,12 +6,11 @@
 // These hash functions are intended to be used to implement hash tables or
 // other data structures that need to map arbitrary strings or byte
 // sequences to a uniform distribution on unsigned 64-bit integers.
+// Each different instance of a hash table or data structure should use its own Seed.
 //
-// The hash functions are collision-resistant but not cryptographically secure.
+// The hash functions are not cryptographically secure.
 // (See crypto/sha256 and crypto/sha512 for cryptographic use.)
 //
-// The hash value of a given byte sequence is consistent within a
-// single process, but will be different in different processes.
 package maphash
 
 import "unsafe"