FHash
FHash is a simple and lightweight hashing crate designed for flexibility, speed, and usability across various Rust environments. It provides a basic hashing algorithm, FHasher, along with a RandomState implementation intended for use in HashMap and HashSet structures. It's a direct competitor to AHash and is 1.3-2.0x faster.
Features
FHasher
- Stupidly Simple: Implements a straightforward hash function, offering basic yet effective hashing capabilities.
- Minimalistic Design: Designed to be lean and efficient, suitable for a wide range of hashing needs without unnecessary complexity.
- Customizable: Provides flexibility by allowing custom seeding for
FHasherinstances.
RandomState
- Enhanced Security: Incorporates randomness into the hashing process, mitigating certain types of hash collision attacks and bolstering security in data structures.
- Easy Integration: Designed for seamless integration with
HashMapandHashSetto enhance resilience against potential vulnerabilities in the hash function.
Usage
RandomState with HashMap/HashSet
use HashMap;
use RandomState;
let mut map: = default;
map.insert;
map.insert;
assert_eq!;
assert_eq!;
FHasher
use FHasher;
let mut hasher = default;
hasher.write;
let hash_result = hasher.finish;
Compatibility
no_stdCompatible: Can be used inno_stdenvironments or scenarios with limited access to the standard library.
Contributing
Contributions to enhance FHash in terms of optimizations, features, or bug fixes are welcome! Please submit issues or pull requests.