Releases: hoxxep/rapidhash
Releases · hoxxep/rapidhash
v4.4.0
Additions
- Added
v3::RapidStreamHasherV3, an incremental streaming hasher with a write/finish API that mirrorsstd::hash::Hasher. It deliberately does not implementHasherdirectly, ensuring hash output remains stable and portable across platforms and compiler versions. Multiple calls towritewill produce the same hash as a single call torapidhash_v3with the concatenated input.
Performance
rapidhash_v3_filenow usesRapidStreamHasherV3internally, replacing the oldChunkedStreamReaderand significantly improving throughput by avoiding redundant buffer copies for large chunks.
What's Changed
Full Changelog: v4.3.0...v4.4.0
v4.3.0
v4.2.2
v4.2.1
Fixes
- Update
rapidhash_v3_filedocs for clarity and correctness.
Pull Request
- Update wasmtime requirement from 39.0.1 to 40.0.0 by @dependabot[bot] in #71
- Update rapidhash_v3_file docs for clarity and correctness. by @hoxxep in #72
Full Changelog: v4.2.0...v4.2.1
v4.2.0
Additions
- Added
GlobalStatewhich initializes aRapidHasherwith a global seed and secrets that are randomized once on application start.
Pull Requests
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #60
- Update wasmtime requirement from 38.0.1 to 39.0.1 by @dependabot[bot] in #61
- Update criterion requirement from 0.7.0 to 0.8.1 by @dependabot[bot] in #63
- Implement GlobalState by @hoxxep in #64
- Improve documentation clarity by @hoxxep in #67
- chore: Replace assert_cmd cargo_bin usage by @hoxxep in #68
- Add benchmarks for GlobalState by @hoxxep in #69
- Prepare 4.2.0 release by @hoxxep in #70
Full Changelog: v4.1.1...v4.2.0
v4.1.1
v4.1.0
What's Changed
Additions
- Added
SeedableState::newandSeedableState::customto create hasher builders with user-defined seeds and secrets. (#50)
Deprecations
SeedableState::with_seedhas been deprecated in favour ofSeedableState::customfor better naming and improved warnings in the documentation. (#50)
Full Changelog: v4.0.0...v4.1.0
v4.0.0
Breaking changes
rapidhash::v3micro/nano output change: input lengths 5-7 were mismatching the intended C++ V3 output. The C++ rapidhash V3 has been yanked and re-released as V3 to fix the bug, and this rust implementation will follow. This changes the hash outputs forrapidhash_v3_micro_inlineandrapidhash_v3_nano_inlinefor inputs of size 5, 6, and 7 bytes.RapidBuildHasherrenamed and refactored toSeedableState.RapidHasher<'s>new lifetime parameter added to support user-defined secrets viaSeedableState.RapidHashMapandRapidHashSetmoved to crate top level for convenience. The top level uses thefast::variants, and thequality::andinner::hashmaps have been removed. They can still be built manually usinginner::RandomStateif required. Thefast::collection variants have been deprecated to be removed in a future major release.
Additions
nightlyfeature which improves str hashing performance by omitting the0xFFsuffix write and adds likely/unlikely hints.SeedableState: a hasher builder which can be seeded with fixed or user-defined secrets. This replacesRapidBuildHasher, but still defaults to random seeds. It is slightly slower thanRandomState.
Performance improvements
- Bounds check elision: Improved
RapidHasherby eliding extra bounds checks in some cases by usingassert_unchecked. - Likely/unlikely hints: Added stable likely/unlikely hints in various places to ensure small inputs are favoured.
MSRV
- MSRV reduced to 1.71.0 from 1.77.0 by removing const usage of
first_chunk.
Full Changelog: v3.1.0...v4.0.0
Main PR: #43
v3.1.0
Performance improvements
- Improved
RapidHashersmall string hashing performance by 1.5-15% depending on the benchmark, by reducing the small string hashing code size and allowing the compiler to inline more. Performance was also improved on big-endian platforms by reading native-endian bytes. The portable hashers (rapidhash::v3etc. modules) are unaffected by this change. #37
Fixes
v3.0.0
Big performance improvements, and potentially rust's fastest general-purpose hasher!
Breaking changes
- Replaced
FNVwith aSPONGEconfiguration withRapidHasherto improve integer and tuple hashing performance. RandomStateremoved thewith_seedandwith_seed_and_static_secretsmethods to reduce the struct size. Please raise a GitHub issue if you need aSeededState-style hash builder for the in-memoryRapidHasher.- Added a
RapidSecretstype for all versions to generate seeds and secrets for HashDoS-resistant hashing. This makes generating unique seeds/secrets easier for persistent hashing use cases.rapidhash::v*portable hashing functions now all take a&RapidSecretsargument as a seed.- For full compatibility with the old integer seeds, instantiate
RapidSecrets::seed_cpp(u64)with your integer seed which will continue to use the default secrets. - For minimal DoS resistance, use
RapidSecrets::seed(u64)to generate a new seed and secrets.
RapidHasherremoved the oldwrite_constandfinish_constmethods as they were unlikely to be used and may cause confusion.rapidhash_v*_innermethods have a newAVALANCHEconst argument to control whether they should avalanche the output. Setting this totruewill match the default hash output and C++ implementation for the highest quality hashing. Turning off avalanching will reduce the hash quality, but improve performance, especially for small inputs.- Fixed the
rapidhash::v1V1_BUGargument to actually match the originalv1.x.xcrate behaviour, which changes the hash output. The if statement was fundamentally wrong in thev2.x.xcrate and failing to hash some bytes, apologies. This now has a proper test to prevent future regressions.
Additions
rapidhash::rng::rapidrng_fast_non_portable: a slightly faster, lower-quality RNG that also has optimisations for u32 platforms without wide-arithmetic support. Excellent for generating fixtures in our WASM benchmarks.
Deprecations
- The V1 and V2
rapidhash_filemethods have been deprecated, with a note to userapidhash::v3instead. This is because they aren't streaming-compatible hashing algorithms which may be misleading if someone has not read the documentation in detail. They will continue to be included for the foreseeable future as they provide the CLI functionality.
Performance improvements
RapidHashersignificantly improved performance hashing integers, tuples, and integer types using the newSPONGEconfiguration in both fast and quality modes.RapidHashernow uses a non-portable mixing function for an improvement on platforms with slow wide arithmetic, such as wasm32.rapidhash::v3has a healthy performance improvement for mid-size input lengths by skipping the 112+ length setup/teardown.