Skip to content

Commit ea7c3ba

Browse files
committed
Auto merge of #357 - Amanieu:ahash-0.8, r=Amanieu
Upgrade to ahash 0.8 This changes the default hasher to use a fixed key by default and removes the dependency on `getrandom`. This is fine since hashbrown has never made any guarantees about HashDoS resistance in its default hasher. Users who require HashDoS resistance should explicitly use `ahash::RandomState` or `std::collections::hash_map::RandomState` as the hasher when creating a `HashMap`. Fixes #356
2 parents f89bcf8 + 597c276 commit ea7c3ba

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rust-version = "1.56.0"
1414

1515
[dependencies]
1616
# For the default hasher
17-
ahash = { version = "0.7.0", default-features = false, optional = true }
17+
ahash = { version = "0.8.0", default-features = false, optional = true }
1818

1919
# For external trait impls
2020
rayon = { version = "1.0", optional = true }
@@ -39,7 +39,6 @@ doc-comment = "0.3.1"
3939
[features]
4040
default = ["ahash", "inline-more"]
4141

42-
ahash-compile-time-rng = ["ahash/compile-time-rng"]
4342
nightly = []
4443
rustc-internal-api = []
4544
rustc-dep-of-std = [

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ This crate has the following Cargo features:
107107
of compilation time. (enabled by default)
108108
- `bumpalo`: Provides a `BumpWrapper` type which allows `bumpalo` to be used for memory allocation.
109109
- `ahash`: Compiles with ahash as default hasher. (enabled by default)
110-
- `ahash-compile-time-rng`: Activates the `compile-time-rng` feature of ahash. For targets with no random number generator
111-
this pre-generates seeds at compile time and embeds them as constants. See [aHash's documentation](https://github.com/tkaitchuck/aHash#flags) (disabled by default)
112110

113111
## License
114112

src/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::ops::Index;
1010

1111
/// Default hasher for `HashMap`.
1212
#[cfg(feature = "ahash")]
13-
pub type DefaultHashBuilder = ahash::RandomState;
13+
pub type DefaultHashBuilder = core::hash::BuildHasherDefault<ahash::AHasher>;
1414

1515
/// Dummy default hasher for `HashMap`.
1616
#[cfg(not(feature = "ahash"))]

0 commit comments

Comments
 (0)