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
83
84
85
86
87
88
use ;
use cratehash_bytes_core;
use crate;
use AxHasher;
// Hashes `bytes` using the default seed (`0`).
//
// This is the simplest entry point. For seeded hashing see [`axhash_seeded`].
//
// # Example
//
// ```rust
// use axhash_core::axhash;
//
// let h = axhash(b"hello");
// assert_ne!(h, 0);
// ```
// Hashes `bytes` with the given `seed`.
//
// The same `(bytes, seed)` pair always produces the same output. Different
// seeds produce independent hash families — use this for hash-flooding
// resistance or domain separation.
//
// # Example
//
// ```rust
// use axhash_core::axhash_seeded;
//
// let h1 = axhash_seeded(b"hello", 0xdead_beef);
// let h2 = axhash_seeded(b"hello", 0xdead_beef);
// assert_eq!(h1, h2);
//
// let h3 = axhash_seeded(b"hello", 0xcafe_f00d);
// assert_ne!(h1, h3);
// ```
// Hashes any value that implements [`Hash`] using the default seed (`0`).
//
// The output depends on how the type implements `Hash`. For stable,
// reproducible hashes across processes or machines prefer a plain-bytes
// representation and [`axhash`] / [`axhash_seeded`].
//
// # Example
//
// ```rust
// use axhash_core::axhash_of;
//
// #[derive(Hash)]
// struct Point { x: i32, y: i32 }
//
// let h = axhash_of(&Point { x: 1, y: 2 });
// assert_ne!(h, 0);
// ```
// Hashes any value that implements [`Hash`] with the given `seed`.
//
// # Example
//
// ```rust
// use axhash_core::axhash_of_seeded;
//
// #[derive(Hash)]
// struct Point { x: i32, y: i32 }
//
// let h = axhash_of_seeded(&Point { x: 1, y: 2 }, 0xdead_beef);
// assert_eq!(h, axhash_of_seeded(&Point { x: 1, y: 2 }, 0xdead_beef));
// ```