Skip to content

Commit e36c7da

Browse files
committed
Clarify documentation of hash::SipHasher
The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links. Fixes #32043.
1 parent 998a672 commit e36c7da

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/libcore/hash/sip.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ 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 the default hashing function used by standard library (eg.
23+
/// `collections::HashMap` uses it by default).
24+
///
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
28+
/// as [`rand::Rng`](https://doc.rust-lang.org/rand/rand/trait.Rng.html).
2629
///
2730
/// Although the SipHash algorithm is considered to be cryptographically
2831
/// strong, this implementation has not been reviewed for such purposes.
29-
/// As such, all cryptographic uses of this implementation are strongly
30-
/// discouraged.
32+
/// As such, all cryptographic uses of this implementation are _strongly
33+
/// discouraged_.
3134
#[stable(feature = "rust1", since = "1.0.0")]
3235
pub struct SipHasher {
3336
k0: u64,

0 commit comments

Comments
 (0)