Remove stable_hash feature and use environment variable.

This commit is contained in:
Stephen Chung
2022-09-27 13:23:47 +08:00
parent a518ab62bb
commit 2ecf44a48e
6 changed files with 41 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
//! Module containing utilities to hash functions and function calls.
use crate::config;
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
use std::{
@@ -74,8 +75,8 @@ impl BuildHasher for StraightHasherBuilder {
#[inline(always)]
#[must_use]
pub fn get_hasher() -> ahash::AHasher {
if cfg!(feature = "stable_hash") {
ahash::RandomState::with_seeds(42, 999, 123, 0).build_hasher()
if let Some([seed1, seed2, seed3, seed4]) = config::AHASH_SEED {
ahash::RandomState::with_seeds(seed1, seed2, seed3, seed4).build_hasher()
} else {
ahash::AHasher::default()
}