gxhash 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- gxhash-0.1.2/PKG-INFO +72 -0
- gxhash-0.1.2/py-gxhash/README.md +62 -0
- gxhash-0.1.2/py-gxhash/gentoo_root.img +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/main.py +38 -39
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/src/lib.rs +0 -1
- {gxhash-0.1.0 → gxhash-0.1.2}/pyproject.toml +8 -7
- gxhash-0.1.0/PKG-INFO +0 -15
- gxhash-0.1.0/py-gxhash/README.md +0 -5
- {gxhash-0.1.0 → gxhash-0.1.2}/.cargo/config.toml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.gitattributes +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.github/workflows/bench.yml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.github/workflows/build_test.yml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.github/workflows/cross_compile.yml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.github/workflows/rust_version.yml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/.gitignore +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/CITATION.cff +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/Cargo.lock +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/Cargo.toml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/LICENSE +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/README.md +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/hashset.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/ilp.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/quality/main.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/aarch64.svg +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/main.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/result_processor.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/x86_64-avx2.svg +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/x86_64-hybrid.svg +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput/x86_64.svg +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/benches/throughput_criterion.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/build.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/examples/hello_world.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/Cargo.lock +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/Cargo.toml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/gxhash.pyi +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/py-gxhash/uv.lock +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/rustfmt.toml +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/gxhash/mod.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/gxhash/platform/arm.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/gxhash/platform/mod.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/gxhash/platform/x86.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/hasher.rs +0 -0
- {gxhash-0.1.0 → gxhash-0.1.2}/src/lib.rs +0 -0
gxhash-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gxhash
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Python: >=3.7
|
|
8
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
9
|
+
|
|
10
|
+
# gxhash-py
|
|
11
|
+
|
|
12
|
+
Python bindings for [GxHash](https://github.com/ogxd/gxhash), a blazingly fast and robust non-cryptographic hashing algorithm.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **Blazingly Fast**: Minimal-overhead binding to leverage the full speed of GxHash.
|
|
17
|
+
- **Zero Python**: Pure Rust backend with zero additional Python runtime overhead.
|
|
18
|
+
- **Fine-Grained Control**: Build true multi-threaded or async hashing pipelines with GIL-free APIs.
|
|
19
|
+
- **Faster File Hashing**: Hash files using memory-mapped I/O via Rust — 3x faster than Python's sequential I/O.
|
|
20
|
+
- **Async-Ready**: Tokio-powered async hashing for fast and efficient concurrency.
|
|
21
|
+
- **Fully Typesafe**: Predictable, clean API with complete type safety.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install gxhash
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Hashing bytes.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from gxhash import GxHash32
|
|
35
|
+
|
|
36
|
+
def main():
|
|
37
|
+
gxhash = GxHash32(seed=0)
|
|
38
|
+
result = gxhash.hash(b"Hello, world!")
|
|
39
|
+
|
|
40
|
+
if __name__ == "__main__":
|
|
41
|
+
main()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Hashing a file.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from gxhash import GxHash64
|
|
48
|
+
|
|
49
|
+
def main():
|
|
50
|
+
gxhash = GxHash64(seed=0)
|
|
51
|
+
file = open("path/to/file.dmg", "rb")
|
|
52
|
+
result = gxhash.hash_file(file)
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
main()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Hashing a file asynchronously.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from asyncio import run
|
|
62
|
+
from gxhash import GxHash128
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
gxhash = GxHash128(seed=0)
|
|
66
|
+
file = open("path/to/file.dmg", "rb")
|
|
67
|
+
result = await gxhash.hash_file_async(file)
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
run(main())
|
|
71
|
+
```
|
|
72
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# gxhash-py
|
|
2
|
+
|
|
3
|
+
Python bindings for [GxHash](https://github.com/ogxd/gxhash), a blazingly fast and robust non-cryptographic hashing algorithm.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Blazingly Fast**: Minimal-overhead binding to leverage the full speed of GxHash.
|
|
8
|
+
- **Zero Python**: Pure Rust backend with zero additional Python runtime overhead.
|
|
9
|
+
- **Fine-Grained Control**: Build true multi-threaded or async hashing pipelines with GIL-free APIs.
|
|
10
|
+
- **Faster File Hashing**: Hash files using memory-mapped I/O via Rust — 3x faster than Python's sequential I/O.
|
|
11
|
+
- **Async-Ready**: Tokio-powered async hashing for fast and efficient concurrency.
|
|
12
|
+
- **Fully Typesafe**: Predictable, clean API with complete type safety.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install gxhash
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Hashing bytes.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from gxhash import GxHash32
|
|
26
|
+
|
|
27
|
+
def main():
|
|
28
|
+
gxhash = GxHash32(seed=0)
|
|
29
|
+
result = gxhash.hash(b"Hello, world!")
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
main()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Hashing a file.
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from gxhash import GxHash64
|
|
39
|
+
|
|
40
|
+
def main():
|
|
41
|
+
gxhash = GxHash64(seed=0)
|
|
42
|
+
file = open("path/to/file.dmg", "rb")
|
|
43
|
+
result = gxhash.hash_file(file)
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Hashing a file asynchronously.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from asyncio import run
|
|
53
|
+
from gxhash import GxHash128
|
|
54
|
+
|
|
55
|
+
async def main():
|
|
56
|
+
gxhash = GxHash128(seed=0)
|
|
57
|
+
file = open("path/to/file.dmg", "rb")
|
|
58
|
+
result = await gxhash.hash_file_async(file)
|
|
59
|
+
|
|
60
|
+
if __name__ == "__main__":
|
|
61
|
+
run(main())
|
|
62
|
+
```
|
|
Binary file
|
|
@@ -89,17 +89,16 @@ collected=7
|
|
|
89
89
|
|
|
90
90
|
async def main():
|
|
91
91
|
try:
|
|
92
|
-
|
|
92
|
+
with Path("gentoo_root.img").open("rb") as img:
|
|
93
|
+
input_bytes = img.read()
|
|
94
|
+
# input_bytes = bytes([42] * 10000000)
|
|
95
|
+
|
|
93
96
|
seed = 1234
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
file.write(input_bytes)
|
|
97
|
-
file.seek(0)
|
|
98
|
-
gxhash128 = GxHash128(seed=seed)
|
|
97
|
+
gxhash64 = GxHash64(seed=seed)
|
|
98
|
+
thread_pool = ThreadPoolExecutor()
|
|
99
99
|
|
|
100
100
|
start = perf_counter_ns()
|
|
101
|
-
|
|
102
|
-
futures = [gxhash128.hash(input_bytes) for _ in range(1)]
|
|
101
|
+
futures = [gxhash64.hash(input_bytes) for _ in range(1)]
|
|
103
102
|
print(f"{(perf_counter_ns() - start) / 1_000_000} ms")
|
|
104
103
|
|
|
105
104
|
tempfiles = [TemporaryFile() for _ in range(1)]
|
|
@@ -108,7 +107,7 @@ async def main():
|
|
|
108
107
|
tfile.seek(0)
|
|
109
108
|
|
|
110
109
|
start = perf_counter_ns()
|
|
111
|
-
hash128_async = [
|
|
110
|
+
hash128_async = [await gxhash64.hash_async(input_bytes) for tfile in tempfiles]
|
|
112
111
|
print(f"{(perf_counter_ns() - start) / 1_000_000} ms")
|
|
113
112
|
|
|
114
113
|
# await asyncio.gather(gxhash(), collect())
|
|
@@ -121,33 +120,33 @@ if __name__ == "__main__":
|
|
|
121
120
|
run(main())
|
|
122
121
|
|
|
123
122
|
|
|
124
|
-
async def main():
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
123
|
+
# async def main():
|
|
124
|
+
# seed = 1234
|
|
125
|
+
# input_bytes = bytes([42] * 1000)
|
|
126
|
+
# file = TemporaryFile()
|
|
127
|
+
# file.write(input_bytes)
|
|
128
|
+
# file.seek(0)
|
|
129
|
+
# gxhash32 = GxHash32(seed=seed)
|
|
130
|
+
# gxhash64 = GxHash64(seed=seed)
|
|
131
|
+
# gxhash128 = GxHash128(seed=seed)
|
|
132
|
+
|
|
133
|
+
# hash32 = gxhash32.hash(input_bytes)
|
|
134
|
+
# hash32_nogil = gxhash32.hash_nogil(input_bytes)
|
|
135
|
+
# hash32_file = gxhash32.hash_file(file)
|
|
136
|
+
# file.seek(0)
|
|
137
|
+
# hash32_file_async = await gxhash32.hash_file_async(file)
|
|
138
|
+
# assert hash32 == hash32_nogil == hash32_file == hash32_file_async
|
|
139
|
+
|
|
140
|
+
# hash64 = gxhash64.hash(input_bytes)
|
|
141
|
+
# hash64_nogil = gxhash64.hash_nogil(input_bytes)
|
|
142
|
+
# hash64_file = gxhash64.hash_file(file)
|
|
143
|
+
# file.seek(0)
|
|
144
|
+
# hash64_file_async = await gxhash64.hash_file_async(file)
|
|
145
|
+
# assert hash64 == hash64_nogil == hash64_file == hash64_file_async
|
|
146
|
+
|
|
147
|
+
# hash128 = gxhash128.hash(input_bytes)
|
|
148
|
+
# hash128_nogil = gxhash128.hash_nogil(input_bytes)
|
|
149
|
+
# hash128_file = gxhash128.hash_file(file)
|
|
150
|
+
# file.seek(0)
|
|
151
|
+
# hash128_file_async = await gxhash128.hash_file_async(file)
|
|
152
|
+
# assert hash128 == hash128_nogil == hash128_file == hash128_file_async
|
|
@@ -17,7 +17,6 @@ fn gxhash_nogil<T: Send>(py: Python, hasher: fn(&[u8], i64) -> T, bytes: &[u8],
|
|
|
17
17
|
fn gxhash_file<T>(hasher: fn(&[u8], i64) -> T, file_descriptor: i32, seed: i64) -> PyResult<T> {
|
|
18
18
|
let file = unsafe { std::fs::File::from_raw_fd(libc::dup(file_descriptor)) };
|
|
19
19
|
let mmap = unsafe { memmap2::Mmap::map(&file)? };
|
|
20
|
-
drop(file);
|
|
21
20
|
Ok(hasher(&mmap, seed))
|
|
22
21
|
}
|
|
23
22
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["maturin>=1.7,<2.0"]
|
|
3
|
-
build-backend = "maturin"
|
|
4
|
-
|
|
5
1
|
[project]
|
|
6
2
|
name = "gxhash"
|
|
3
|
+
version = "0.1.2"
|
|
7
4
|
requires-python = ">=3.7"
|
|
8
5
|
dynamic = ["version"]
|
|
9
6
|
classifiers = [
|
|
@@ -12,9 +9,13 @@ classifiers = [
|
|
|
12
9
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
13
10
|
]
|
|
14
11
|
|
|
12
|
+
[dependency-groups]
|
|
13
|
+
dev = ["maturin>=1.7.4"]
|
|
14
|
+
|
|
15
|
+
[build-system]
|
|
16
|
+
requires = ["maturin>=1.7,<2.0"]
|
|
17
|
+
build-backend = "maturin"
|
|
18
|
+
|
|
15
19
|
[tool.maturin]
|
|
16
20
|
features = ["pyo3/extension-module"]
|
|
17
21
|
manifest-path = "py-gxhash/Cargo.toml"
|
|
18
|
-
|
|
19
|
-
[dependency-groups]
|
|
20
|
-
dev = ["maturin>=1.7.4"]
|
gxhash-0.1.0/PKG-INFO
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: gxhash
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Classifier: Programming Language :: Rust
|
|
5
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
-
Requires-Python: >=3.7
|
|
8
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
9
|
-
|
|
10
|
-
# py-gxhash
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
uv sync --reinstall
|
|
14
|
-
```
|
|
15
|
-
|
gxhash-0.1.0/py-gxhash/README.md
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|