1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2026 FastLabs Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// The API organization and streaming design were informed by twox-hash 2.1.4.
// Source adaptations are identified in the individual implementation files.
// https://github.com/shepmaster/twox-hash/tree/6f866bffe73900c63df2650be4eed41e3ed9b500/src
//! xxHash one-shot, streaming, hash-table, and XXH3 kernel APIs.
//!
//! Use [`xxh32`] and [`Xxh32`] for XXH32, [`xxh64`] and [`Xxh64`] for XXH64,
//! and [`xxh3_64`]/[`Xxh3_64`] or [`xxh3_128`]/[`Xxh3_128`] for XXH3. Every
//! variant supports complete byte slices and bounded-memory incremental input.
//! The 32- and 64-bit states implement [`core::hash::Hasher`] and have matching
//! builders; the 128-bit state keeps its full `u128` result instead.
//!
//! XXH3 is the preferred general-purpose family for new trusted-input use. Its
//! explicitly named configuration functions and constructors support a seed, a
//! custom secret, or the reference algorithm's seed-and-secret routing. Custom
//! secrets must contain at least [`SECRET_SIZE_MIN`] bytes. They change the
//! deterministic output but do not protect attacker-controlled hash tables.
//!
//! Enable the `std` feature for [`std::io::Write`] integration and runtime
//! CPU-feature detection. The [`kernel`] module reports the selected scalar or
//! hardware XXH3 backend; ordinary callers do not need to choose one.
//!
//! ```
//! use hashcrew::xxhash::Xxh3_64;
//! use hashcrew::xxhash::xxh3_64;
//!
//! let mut state = Xxh3_64::new();
//! state.update(b"hash");
//! state.update(b"crew");
//! assert_eq!(state.digest(), xxh3_64(b"hashcrew"));
//! ```
//!
//! # Digest representation
//!
//! Use the returned integer's `to_be_bytes()` for the
//! [canonical xxHash byte format](https://github.com/Cyan4973/xxHash/blob/v0.8.3/xxhash.h).
//! This applies to XXH32, XXH64, XXH3-64, and XXH3-128. Hexadecimal text uses
//! the integer's usual order: `format!("{:016x}", xxh3_64(input))` for 64 bits,
//! `:08x` for 32 bits, and `:032x` for 128 bits, preserving leading zeroes.
pub use DEFAULT_SECRET;
pub use DEFAULT_SECRET_SIZE;
pub use SECRET_SIZE_MIN;
pub use Xxh3_64;
pub use Xxh3_64Builder;
pub use Xxh3_64SecretBuilder;
pub use Xxh3_128;
pub use Xxh3SecretTooShort;
pub use xxh3_64;
pub use xxh3_64_with_secret;
pub use xxh3_64_with_seed;
pub use xxh3_64_with_seed_and_secret;
pub use xxh3_128;
pub use xxh3_128_with_secret;
pub use xxh3_128_with_seed;
pub use xxh3_128_with_seed_and_secret;
pub use Xxh32;
pub use Xxh32Builder;
pub use xxh32;
pub use Xxh64;
pub use Xxh64Builder;
pub use xxh64;