Skip to content

Releases: hoxxep/rapidhash

v4.4.0

16 Feb 17:51
8b1e907

Choose a tag to compare

Additions

  • Added v3::RapidStreamHasherV3, an incremental streaming hasher with a write/finish API that mirrors std::hash::Hasher. It deliberately does not implement Hasher directly, ensuring hash output remains stable and portable across platforms and compiler versions. Multiple calls to write will produce the same hash as a single call to rapidhash_v3 with the concatenated input.

Performance

  • rapidhash_v3_file now uses RapidStreamHasherV3 internally, replacing the old ChunkedStreamReader and significantly improving throughput by avoiding redundant buffer copies for large chunks.

What's Changed

  • RapidStreamHasherV3 implementation, test, and benchmarks by @hoxxep in #81

Full Changelog: v4.3.0...v4.4.0

v4.3.0

16 Feb 17:50
fb81b94

Choose a tag to compare

What's Changed

  • Derive Debug for RandomState by @anp in #78
  • Implement a consistent Debug on all inner::state::*_state.rs types by @hoxxep in #79

Full Changelog: v4.2.2...v4.3.0

v4.2.2

05 Feb 22:24
31e5d58

Choose a tag to compare

Fixes

  • Symlink license files for rapidhash crate. by @anp in #77

New Contributors

  • @anp made their first contribution in #77

Full Changelog: v4.2.1...v4.2.2

v4.2.1

11 Jan 00:14
3097e82

Choose a tag to compare

Fixes

  • Update rapidhash_v3_file docs 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

20 Dec 13:17
4eb64d9

Choose a tag to compare

Additions

  • Added GlobalState which initializes a RapidHasher with a global seed and secrets that are randomized once on application start.

Pull Requests

Full Changelog: v4.1.1...v4.2.0

v4.1.1

21 Oct 13:29
381076d

Choose a tag to compare

Fixes

  • Fixed docsrs build flags, replacing doc_auto_cfg with doc_cfg. (#55)
  • Fixed broken docsrs links. (#57)

v4.1.0

12 Sep 11:29
9692728

Choose a tag to compare

What's Changed

Additions

  • Added SeedableState::new and SeedableState::custom to create hasher builders with user-defined seeds and secrets. (#50)

Deprecations

  • SeedableState::with_seed has been deprecated in favour of SeedableState::custom for better naming and improved warnings in the documentation. (#50)

Full Changelog: v4.0.0...v4.1.0

v4.0.0

26 Aug 10:44
ba3ec61

Choose a tag to compare

Breaking changes

  • rapidhash::v3 micro/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 for rapidhash_v3_micro_inline and rapidhash_v3_nano_inline for inputs of size 5, 6, and 7 bytes.
  • RapidBuildHasher renamed and refactored to SeedableState.
  • RapidHasher<'s> new lifetime parameter added to support user-defined secrets via SeedableState.
  • RapidHashMap and RapidHashSet moved to crate top level for convenience. The top level uses the fast:: variants, and the quality:: and inner:: hashmaps have been removed. They can still be built manually using inner::RandomState if required. The fast:: collection variants have been deprecated to be removed in a future major release.

Additions

  • nightly feature which improves str hashing performance by omitting the 0xFF suffix write and adds likely/unlikely hints.
  • SeedableState: a hasher builder which can be seeded with fixed or user-defined secrets. This replaces RapidBuildHasher, but still defaults to random seeds. It is slightly slower than RandomState.

Performance improvements

  • Bounds check elision: Improved RapidHasher by eliding extra bounds checks in some cases by using assert_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

09 Aug 13:57
58ffca9

Choose a tag to compare

Performance improvements

  • Improved RapidHasher small 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::v3 etc. modules) are unaffected by this change. #37

Fixes

  • Fixed compilation on targets without atomic pointers. #38, #39

v3.0.0

04 Aug 11:08
0b81fc9

Choose a tag to compare

Big performance improvements, and potentially rust's fastest general-purpose hasher!

Breaking changes

  • Replaced FNV with a SPONGE configuration with RapidHasher to improve integer and tuple hashing performance.
  • RandomState removed the with_seed and with_seed_and_static_secrets methods to reduce the struct size. Please raise a GitHub issue if you need a SeededState-style hash builder for the in-memory RapidHasher.
  • Added a RapidSecrets type 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 &RapidSecrets argument 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.
  • RapidHasher removed the old write_const and finish_const methods as they were unlikely to be used and may cause confusion.
  • rapidhash_v*_inner methods have a new AVALANCHE const argument to control whether they should avalanche the output. Setting this to true will 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::v1 V1_BUG argument to actually match the original v1.x.x crate behaviour, which changes the hash output. The if statement was fundamentally wrong in the v2.x.x crate 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_file methods have been deprecated, with a note to use rapidhash::v3 instead. 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

  • RapidHasher significantly improved performance hashing integers, tuples, and integer types using the new SPONGE configuration in both fast and quality modes.
  • RapidHasher now uses a non-portable mixing function for an improvement on platforms with slow wide arithmetic, such as wasm32.
  • rapidhash::v3 has a healthy performance improvement for mid-size input lengths by skipping the 112+ length setup/teardown.