EmbarkStudios / mirror-mirror

🪞 Powerful reflection library for Rust
Apache License 2.0
79 stars 2 forks source link

Use seed to generate predictable hashes #115

Closed TimonPost closed 1 year ago

TimonPost commented 1 year ago

Specifies a constant seed that allows cross-process-deterministic hashes to be generated.

Using this static random state in HashMap and the generation of NodeId allows this crate to generate predictable trees when serializing/deserializing encoding/decoding hashing.

See: https://docs.rs/ahash/latest/ahash/random_state/struct.RandomState.html

image

Currently, the hasher is seeded first time when the AHasher is constructed.