Skip to content

Commit 3e764ef

Browse files
committed
Rollup merge of rust-lang#32091 - dirk:dirk/siphasher-docs-clarification, r=alexcrichton
Clarify documentation of hash::SipHasher The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links. Fixes rust-lang#32043. r? @sfackler
2 parents 09e08ba + 46dc35e commit 3e764ef

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/libcore/hash/sip.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ use super::Hasher;
1919
///
2020
/// See: http://131002.net/siphash/
2121
///
22-
/// Consider this as a main "general-purpose" hash for all hashtables: it
23-
/// runs at good speed (competitive with spooky and city) and permits
24-
/// strong _keyed_ hashing. Key your hashtables from a strong RNG,
25-
/// such as `rand::Rng`.
22+
/// This is currently the default hashing function used by standard library
23+
/// (eg. `collections::HashMap` uses it by default).
2624
///
27-
/// Although the SipHash algorithm is considered to be cryptographically
28-
/// strong, this implementation has not been reviewed for such purposes.
29-
/// As such, all cryptographic uses of this implementation are strongly
30-
/// discouraged.
25+
/// SipHash is a general-purpose hashing function: it runs at a good
26+
/// speed (competitive with Spooky and City) and permits strong _keyed_
27+
/// hashing. This lets you key your hashtables from a strong RNG, such as
28+
/// [`rand::os::OsRng`](https://doc.rust-lang.org/rand/rand/os/struct.OsRng.html).
29+
///
30+
/// Although the SipHash algorithm is considered to be generally strong,
31+
/// it is not intended for cryptographic purposes. As such, all
32+
/// cryptographic uses of this implementation are _strongly discouraged_.
3133
#[stable(feature = "rust1", since = "1.0.0")]
3234
pub struct SipHasher {
3335
k0: u64,

0 commit comments

Comments
 (0)