tkaitchuck / aHash

aHash is a non-cryptographic hashing algorithm that uses the AES hardware instruction
https://crates.io/crates/ahash
Apache License 2.0
1.03k stars 101 forks source link

Hash output is different when using target-cpu=native #236

Closed kurtlawrence closed 1 month ago

kurtlawrence commented 4 months ago

I am seeing different hash values when compiling with/without -Ctarget-cpu=native

> cargo r
Hello, world!
2812988653723342679

> RUSTFLAGS='-C target-cpu=native' cargo r
Hello, world!
10721529036479106072
Files

Cargo.toml: ``` [package] name = "hash-test" version = "0.1.0" edition = "2021" [dependencies] ahash = "0.8.11" ``` src/main.rs: ``` use ahash::RandomState; const HASHER: RandomState = RandomState::with_seeds(42, 42, 42, 42); fn main() { let name = "Hello, world!"; println!("{}", name); println!("{}", HASHER.hash_one(name)); } ```

tkaitchuck commented 1 month ago

Yes. This is deliberate. See the README.