gxhash 3.4.1__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gxhash might be problematic. Click here for more details.

@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: gxhash
3
+ Version: 3.4.1
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE
8
+ Summary: GxHash non-cryptographic algorithm
9
+ Keywords: hash,hasher,hashmap,no-std,crypto
10
+ Author: Olivier Giniaux
11
+ License: MIT
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Source Code, https://github.com/ogxd/gxhash
15
+
16
+ # GxHash
17
+ [![Build & Test](https://github.com/ogxd/gxhash/actions/workflows/build_test.yml/badge.svg)](https://github.com/ogxd/gxhash/actions/workflows/build_test.yml)
18
+ [![Cross Compile](https://github.com/ogxd/gxhash/actions/workflows/cross_compile.yml/badge.svg)](https://github.com/ogxd/gxhash/actions/workflows/cross_compile.yml)
19
+ [![Rust Version Compatibility](https://github.com/ogxd/gxhash/actions/workflows/rust_version.yml/badge.svg)](https://github.com/ogxd/gxhash/actions/workflows/rust_version.yml)
20
+
21
+ GxHash is a [**blazingly fast**](#performance) and [**robust**](#robustness) non-cryptographic hashing algorithm.
22
+
23
+ **[Features](#features) | [Considerations](#important-considerations) | [Usage](#usage) | [Benchmarks](#benchmarks) | [Contributing](#contributing)**
24
+
25
+ ## Features
26
+
27
+ ### Blazingly Fast 🚀
28
+ Up to this date, GxHash is the fastest non-cryptographic hashing algorithm of its class, for all input sizes. This performance is possible mostly thanks to heavy usage of SIMD intrinsics, high ILP construction, a small bytecode (easily inlined and cached) and some ([outrageously unsafe](https://ogxd.github.io/articles/unsafe-read-beyond-of-death/)) tricks.
29
+
30
+ See the [benchmarks](#benchmarks).
31
+
32
+ ### Highly Robust 🗿
33
+ GxHash uses several rounds of hardware-accelerated AES block cipher for efficient bit mixing.
34
+ Thanks to this, GxHash passes all [SMHasher](https://github.com/rurban/smhasher) tests, which is the de facto quality benchmark for non-cryptographic hash functions, gathering most of the existing algorithms. GxHash has low collisions, uniform distribution and high avalanche properties.
35
+
36
+ Check out the [paper](https://github.com/ogxd/gxhash-rust/blob/main/article/article.pdf) for more technical details.
37
+
38
+ ### 0 Dependencies 📦
39
+ GxHash has 0 cargo dependency. The `Hasher` and `Hashset`/`Hashmap` convenience types require the standard library, enabled by default with the `std` feature.
40
+
41
+ ## Important Considerations
42
+
43
+ ### Hardware Acceleration
44
+ GxHash requires a few specific hardware acceleration features, which are supported on *most* modern processors, but not all of them.
45
+ - X86 processors with `AES-NI` & `SSE2` intrinsics
46
+ - ARM processors with `AES` & `NEON` intrinsics
47
+ > **Warning**
48
+ > Other platforms are currently not supported (there is no fallback). GxHash will not build on these platforms.
49
+
50
+ In case you are building gxhash without the required features, the crate will fail to build with an error message like this (even if you know your target supports the required features):
51
+ ```
52
+ Gxhash requires aes and sse2 intrinsics. Make sure the processor supports it and build with RUSTFLAGS="-C target-cpu=native" or RUSTFLAGS="-C target-feature=+aes,+sse2"
53
+ ```
54
+
55
+ To fix this, simply follow the instructions in the error message. Setting `RUSTFLAGS` to `-C target-cpu=native` should work if your CPU is properly recognized by rustc, which is the case most of the time.
56
+
57
+ ### Hashes Stability
58
+ All generated hashes for a given major version of GxHash are stable, meaning that for a given input the output hash will be the same across all supported platforms. This also means that the hash may change between majors versions (eg gxhash 2.x and 3.x).
59
+
60
+ ### Consistency of Hashes When Using the `Hasher` Trait
61
+ The `Hasher` trait defines methods to hash specific types. This allows the implementation to circumvent some tricks used when the size is unknown. For this reason, hashing 4 `u32` using a `Hasher` will return a different hash compared to using the `gxhash128` method directly with these same 4 `u32` but represented as 16 `u8`. The rationale being that `Hasher` (mostly used for things like `HashMap` or `HashSet`) and `gxhash128` are used in two different scenarios. Both way are independently stable still.
62
+
63
+ ### Unsafety
64
+ In order to achieve this magnitude of performance, this crate contains unsafe code, and a [trick](https://ogxd.github.io/articles/unsafe-read-beyond-of-death/) that some people qualify as "undefined behavior". For this reason, this crate is not intended for use in safety-critical applications, but rather for applications that require extreme hashing performance and that are less concerned about this aspect.
65
+
66
+ ### Security
67
+ GxHash is seeded (with seed randomization) to improve DOS resistance and uses a wide (128-bit) internal state to improve multicollision resistance. Yet, such resistances are just basic safeguards and do not make GxHash secure against all attacks.
68
+
69
+ Also, it is important to note that GxHash is not a cryptographic hash function and should not be used for cryptographic purposes.
70
+
71
+ ## Usage
72
+ ```bash
73
+ cargo add gxhash
74
+ ```
75
+ Used directly as a hash function:
76
+ ```rust
77
+ let bytes: &[u8] = "hello world".as_bytes();
78
+ let seed = 1234;
79
+ println!(" 32-bit hash: {:x}", gxhash::gxhash32(&bytes, seed));
80
+ println!(" 64-bit hash: {:x}", gxhash::gxhash64(&bytes, seed));
81
+ println!("128-bit hash: {:x}", gxhash::gxhash128(&bytes, seed));
82
+ ```
83
+
84
+ GxHash provides an implementation of the [`Hasher`](core::hash::Hasher) trait.
85
+ For convenience, this crate also provides the type aliases `gxhash::HashMap` and `gxhash::HashSet`.
86
+
87
+ ```rust
88
+ use gxhash::{HashMap, HashMapExt};
89
+
90
+ let mut map: HashMap<&str, i32> = HashMap::new();
91
+ map.insert("answer", 42);
92
+ ```
93
+
94
+ ## Flags
95
+
96
+ ### `no_std`
97
+
98
+ The `std` feature flag enables the `HashMap`/`HashSet` container convenience type aliases. This is on by default. Disable to make the crate `no_std`:
99
+
100
+ ```toml
101
+ [dependencies.gxhash]
102
+ ...
103
+ default-features = false
104
+ ```
105
+
106
+ ### `hybrid`
107
+
108
+ The `hybrid` feature flag enables a hybrid implementation of GxHash. This is disabled by default. When `hybrid` feature is enabled and for CPUs that supports it, GxHash will use wider registers and instructions (`VAES` + `AVX2`), which can lead to a significant performance improvement for large inputs. This preserves hashes stability, meaning that hashes generated with or without the `hybrid` feature are the same for a given input and seed.
109
+
110
+ *Note: Even without this feature enabled GxHash is already the fastest option out there. We recommend enabling this feature only when inputs can be larger than a few hundred bytes, see the benchmarks below.*
111
+
112
+ ## Benchmarks
113
+
114
+ [![Benchmark](https://github.com/ogxd/gxhash/actions/workflows/bench.yml/badge.svg)](https://github.com/ogxd/gxhash/actions/workflows/bench.yml)
115
+ GxHash is continuously benchmarked on X86 and ARM GitHub runners.
116
+
117
+ Important: If performance if a critical feature for your application, don't forget to benchmark the cost of hashing in your own context. Numbers shared here may be radically different in your environment and with your hardware.
118
+
119
+ To run the benchmarks locally use one of the following:
120
+ ```bash
121
+ # Benchmark throughput
122
+ # Add --features bench-md for markdown output or --features bench-plot for .svg plots
123
+ cargo bench --bench throughput
124
+
125
+ # Benchmark performance of GxHash's Hasher when used in a HashSet
126
+ cargo bench --bench hashset
127
+ ```
128
+
129
+ ### Throughput
130
+
131
+ Throughput is measured as the number of bytes hashed per second.
132
+
133
+ *Some prefer talking of **latency** (time for generating a hash) or **hashrate** (the number of hashes generated per second) for measuring hash function performance, but those are all equivalent in the end as they all boil down to measuring the time it takes to hash some input and then apply different scalar transformation. For instance, if latency for a `4 bytes` hash is `1 ms`, then the throughput is `1 / 0.001 * 4 = 4000 bytes per second`. Throughput allows us to conveniently compare the performance of a hash function for any input size on a single graph.*
134
+
135
+ The `throughput` benchmark is custom (it does not rely on criterion.rs). In an attempt of reducing biais in this microbenchmark as much as possible, it shuffles seeds, input data, and alignment. It also has the benefit of being less of a "black box" compared to criterion. There is however a criterion-based throughput benchmark named `throughput_criterion` if you prefer. Results vary slightly between the two benchmarks, don't hesitate to submit an issue if you suspect biais and want to suggest improvements.
136
+
137
+ **Latest Benchmark Results:**
138
+ ![aarch64](./benches/throughput/aarch64.svg)
139
+ ![x86_64](./benches/throughput/x86_64.svg)
140
+ ![x86_64-hybrid](./benches/throughput/x86_64-hybrid.svg)
141
+
142
+ ## Contributing
143
+
144
+ - Feel free to submit PRs
145
+ - Repository is entirely usable via `cargo` commands
146
+ - Versioning is the following
147
+ - Major for stability breaking changes (output hashes for a same input are different after changes)
148
+ - Minor for API changes/removal
149
+ - Patch for new APIs, bug fixes and performance improvements
150
+
151
+ #### Useful profiling tools
152
+ - [cargo-show-asm](https://github.com/pacak/cargo-show-asm) is an easy way to view the actual generated assembly code. You can use the hello_world example to view the isolated, unoptimized byte code for gxhash. A few useful commands:
153
+ - Line by line generated asm: `cargo asm --rust --simplify --example hello_world hello_world::gxhash`
154
+ - Generated llvm: `cargo asm --llvm --example hello_world hello_world::gxhash`
155
+ - Count of assembly instructions: `cargo asm --simplify --example hello_world hello_world::gxhash | grep -v '^\.' | wc -l`
156
+ - Powershell version: `cargo asm --simplify --example hello_world hello_world::gxhash | where { !$_.StartsWith(".") } | measure -Line`
157
+ - [AMD μProf](https://www.amd.com/en/developer/uprof.html) gives some useful insights on time spent per instruction.
158
+
159
+ ## Publication
160
+ > Author note:
161
+ > I'm committed to the open dissemination of scientific knowledge. In an era where access to information is more democratized than ever, I believe that science should be freely available to all – both for consumption and contribution. Traditional scientific journals often involve significant financial costs, which can introduce biases and can shift the focus from purely scientific endeavors to what is currently trendy.
162
+ >
163
+ > To counter this trend and to uphold the true spirit of research, I have chosen to share my work on "gxhash" directly on GitHub, ensuring that it's openly accessible to anyone interested. Additionally, the use of a free Zenodo DOI ensures that this research is citable and can be referenced in other works, just as traditional publications are.
164
+ >
165
+ > I strongly believe in a world where science is not behind paywalls, and I am in for a more inclusive, unbiased, and open scientific community.
166
+
167
+ Publication:
168
+ [PDF](https://github.com/ogxd/gxhash-rust/blob/main/article/article.pdf)
169
+
170
+ Cite this publication / algorithm:
171
+ [![DOI](https://zenodo.org/badge/690754256.svg)](https://zenodo.org/badge/latestdoi/690754256)
172
+
@@ -0,0 +1,6 @@
1
+ gxhash-3.4.1.dist-info/METADATA,sha256=8SNYSmr4uEtfb5ZDWBNQR_pfplOHrzd09ksxBOoqi5Q,11249
2
+ gxhash-3.4.1.dist-info/WHEEL,sha256=tpW5AN9B-9qsM9WW2FXG2r193YXiqexDadpKp0A2daI,96
3
+ gxhash-3.4.1.dist-info/licenses/LICENSE,sha256=j0LUVdKhD9BjMVLDqXGoMrkbEVuVvvZ7W8jGpPZBKQ8,1093
4
+ gxhashpy/__init__.py,sha256=_4OS9RrGeN78-7qIE47JYnbRZ1e0yxTU-kMoTRRFQyM,115
5
+ gxhashpy/gxhashpy.cp312-win_amd64.pyd,sha256=FUdjMTqg7Yix731Git0hb4ivIF9CFYESj8L7jElvOyE,204288
6
+ gxhash-3.4.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.8.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Olivier Giniaux
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
gxhashpy/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .gxhashpy import *
2
+
3
+ __doc__ = gxhashpy.__doc__
4
+ if hasattr(gxhashpy, "__all__"):
5
+ __all__ = gxhashpy.__all__
Binary file