hashcodecs 0.6.0__cp315-cp315-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.
hashcodecs/__init__.py ADDED
@@ -0,0 +1,74 @@
1
+ """SIMD-accelerated Base64, MurmurHash3, and xxHash functions."""
2
+
3
+ from .base64 import (
4
+ b64decode,
5
+ b64decode_batch,
6
+ b64decode_batch_into,
7
+ b64decode_into,
8
+ b64encode,
9
+ b64encode_batch,
10
+ b64encode_batch_into,
11
+ b64encode_into,
12
+ standard_b64decode,
13
+ standard_b64decode_batch,
14
+ standard_b64decode_batch_into,
15
+ standard_b64decode_into,
16
+ standard_b64encode,
17
+ standard_b64encode_batch,
18
+ standard_b64encode_batch_into,
19
+ standard_b64encode_into,
20
+ urlsafe_b64decode,
21
+ urlsafe_b64decode_batch,
22
+ urlsafe_b64decode_batch_into,
23
+ urlsafe_b64decode_into,
24
+ urlsafe_b64encode,
25
+ urlsafe_b64encode_batch,
26
+ urlsafe_b64encode_batch_into,
27
+ urlsafe_b64encode_into,
28
+ )
29
+ from .murmur3 import (
30
+ murmur3_32,
31
+ murmur3_x64_128,
32
+ murmur3_x64_128_digest,
33
+ murmur3_x86_32,
34
+ murmur3_x86_128,
35
+ murmur3_x86_128_digest,
36
+ )
37
+ from .xxhash import xxh3_64, xxh3_64_batch, xxh3_128, xxh3_128_batch
38
+
39
+ __all__ = [
40
+ 'b64decode',
41
+ 'b64decode_batch',
42
+ 'b64decode_batch_into',
43
+ 'b64decode_into',
44
+ 'b64encode',
45
+ 'b64encode_batch',
46
+ 'b64encode_batch_into',
47
+ 'b64encode_into',
48
+ 'murmur3_32',
49
+ 'murmur3_x64_128',
50
+ 'murmur3_x64_128_digest',
51
+ 'murmur3_x86_32',
52
+ 'murmur3_x86_128',
53
+ 'murmur3_x86_128_digest',
54
+ 'standard_b64decode',
55
+ 'standard_b64decode_batch',
56
+ 'standard_b64decode_batch_into',
57
+ 'standard_b64decode_into',
58
+ 'standard_b64encode',
59
+ 'standard_b64encode_batch',
60
+ 'standard_b64encode_batch_into',
61
+ 'standard_b64encode_into',
62
+ 'urlsafe_b64decode',
63
+ 'urlsafe_b64decode_batch',
64
+ 'urlsafe_b64decode_batch_into',
65
+ 'urlsafe_b64decode_into',
66
+ 'urlsafe_b64encode',
67
+ 'urlsafe_b64encode_batch',
68
+ 'urlsafe_b64encode_batch_into',
69
+ 'urlsafe_b64encode_into',
70
+ 'xxh3_64',
71
+ 'xxh3_64_batch',
72
+ 'xxh3_128',
73
+ 'xxh3_128_batch',
74
+ ]
Binary file
@@ -0,0 +1,107 @@
1
+ from _typeshed import ReadableBuffer
2
+
3
+ def b64encode(
4
+ s: ReadableBuffer,
5
+ altchars: ReadableBuffer | None = None,
6
+ *,
7
+ padded: bool = True,
8
+ wrapcol: int = 0,
9
+ ) -> bytes: ...
10
+ def b64encode_batch(items: list[ReadableBuffer], altchars: ReadableBuffer | None = None) -> list[bytes]: ...
11
+ def b64encode_batch_into(
12
+ items: list[ReadableBuffer],
13
+ outputs: list[bytearray],
14
+ altchars: ReadableBuffer | None = None,
15
+ ) -> list[int]: ...
16
+ def b64encode_into(
17
+ s: ReadableBuffer,
18
+ output: bytearray,
19
+ altchars: ReadableBuffer | None = None,
20
+ *,
21
+ padded: bool = True,
22
+ wrapcol: int = 0,
23
+ ) -> int: ...
24
+ def b64decode(
25
+ s: str | ReadableBuffer,
26
+ altchars: str | ReadableBuffer | None = None,
27
+ validate: bool = ...,
28
+ *,
29
+ padded: bool = True,
30
+ ignorechars: ReadableBuffer = ...,
31
+ canonical: bool = False,
32
+ ) -> bytes: ...
33
+ def b64decode_batch(
34
+ items: list[str | ReadableBuffer],
35
+ altchars: str | ReadableBuffer | None = None,
36
+ validate: bool = False,
37
+ ) -> list[bytes]: ...
38
+ def b64decode_batch_into(
39
+ items: list[str | ReadableBuffer],
40
+ outputs: list[bytearray],
41
+ altchars: str | ReadableBuffer | None = None,
42
+ validate: bool = False,
43
+ ) -> list[int]: ...
44
+ def b64decode_into(
45
+ s: str | ReadableBuffer,
46
+ output: bytearray,
47
+ altchars: str | ReadableBuffer | None = None,
48
+ validate: bool = ...,
49
+ *,
50
+ padded: bool = True,
51
+ ignorechars: ReadableBuffer = ...,
52
+ canonical: bool = False,
53
+ ) -> int: ...
54
+ def standard_b64encode(s: ReadableBuffer) -> bytes: ...
55
+ def standard_b64encode_into(s: ReadableBuffer, output: bytearray) -> int: ...
56
+ def standard_b64decode(s: str | ReadableBuffer) -> bytes: ...
57
+ def standard_b64decode_into(s: str | ReadableBuffer, output: bytearray) -> int: ...
58
+ def urlsafe_b64encode(s: ReadableBuffer, *, padded: bool = True) -> bytes: ...
59
+ def urlsafe_b64encode_into(s: ReadableBuffer, output: bytearray, *, padded: bool = True) -> int: ...
60
+ def urlsafe_b64decode(s: str | ReadableBuffer, *, padded: bool = ...) -> bytes: ...
61
+ def urlsafe_b64decode_into(s: str | ReadableBuffer, output: bytearray, *, padded: bool = ...) -> int: ...
62
+ def murmur3_32(s: ReadableBuffer, seed: int = 0) -> int: ...
63
+ def murmur3_x86_128_digest(s: ReadableBuffer, seed: int = 0) -> bytes: ...
64
+ def murmur3_x64_128_digest(s: ReadableBuffer, seed: int = 0) -> bytes: ...
65
+ def xxh3_64(s: ReadableBuffer, seed: int = 0) -> int: ...
66
+ def xxh3_128(s: ReadableBuffer, seed: int = 0) -> int: ...
67
+ def xxh3_64_batch(items: list[ReadableBuffer], seed: int = 0) -> list[int]: ...
68
+ def xxh3_128_batch(items: list[ReadableBuffer], seed: int = 0) -> list[int]: ...
69
+
70
+ class murmur3_x86_32:
71
+ def __init__(self, data: ReadableBuffer | None = None, seed: int = 0) -> None: ...
72
+ def update(self, data: ReadableBuffer) -> None: ...
73
+ def digest(self) -> bytes: ...
74
+ def hexdigest(self) -> str: ...
75
+ def copy(self) -> murmur3_x86_32: ...
76
+ @property
77
+ def digest_size(self) -> int: ...
78
+ @property
79
+ def block_size(self) -> int: ...
80
+ @property
81
+ def name(self) -> str: ...
82
+
83
+ class murmur3_x86_128:
84
+ def __init__(self, data: ReadableBuffer | None = None, seed: int = 0) -> None: ...
85
+ def update(self, data: ReadableBuffer) -> None: ...
86
+ def digest(self) -> bytes: ...
87
+ def hexdigest(self) -> str: ...
88
+ def copy(self) -> murmur3_x86_128: ...
89
+ @property
90
+ def digest_size(self) -> int: ...
91
+ @property
92
+ def block_size(self) -> int: ...
93
+ @property
94
+ def name(self) -> str: ...
95
+
96
+ class murmur3_x64_128:
97
+ def __init__(self, data: ReadableBuffer | None = None, seed: int = 0) -> None: ...
98
+ def update(self, data: ReadableBuffer) -> None: ...
99
+ def digest(self) -> bytes: ...
100
+ def hexdigest(self) -> str: ...
101
+ def copy(self) -> murmur3_x64_128: ...
102
+ @property
103
+ def digest_size(self) -> int: ...
104
+ @property
105
+ def block_size(self) -> int: ...
106
+ @property
107
+ def name(self) -> str: ...
hashcodecs/base64.py ADDED
@@ -0,0 +1,101 @@
1
+ """A fast, API-compatible subset of Python's :mod:`base64` module."""
2
+
3
+ from ._hashcodecs import (
4
+ b64decode,
5
+ b64decode_batch,
6
+ b64decode_batch_into,
7
+ b64decode_into,
8
+ b64encode,
9
+ b64encode_batch,
10
+ b64encode_batch_into,
11
+ b64encode_into,
12
+ standard_b64decode,
13
+ standard_b64decode_into,
14
+ standard_b64encode,
15
+ standard_b64encode_into,
16
+ urlsafe_b64decode,
17
+ urlsafe_b64decode_into,
18
+ urlsafe_b64encode,
19
+ urlsafe_b64encode_into,
20
+ )
21
+
22
+ for _function in (
23
+ standard_b64decode,
24
+ standard_b64decode_into,
25
+ standard_b64encode,
26
+ standard_b64encode_into,
27
+ urlsafe_b64decode,
28
+ urlsafe_b64decode_into,
29
+ urlsafe_b64encode,
30
+ urlsafe_b64encode_into,
31
+ ):
32
+ _function.__module__ = __name__
33
+ del _function
34
+
35
+
36
+ def standard_b64encode_batch(items) -> list[bytes]:
37
+ """Encode a list of inputs with the standard Base64 alphabet."""
38
+ return b64encode_batch(items)
39
+
40
+
41
+ def standard_b64encode_batch_into(items, outputs: list[bytearray]) -> list[int]:
42
+ """Encode a list of inputs with the standard alphabet into reusable outputs."""
43
+ return b64encode_batch_into(items, outputs)
44
+
45
+
46
+ def standard_b64decode_batch(items) -> list[bytes]:
47
+ """Decode a list of inputs with the standard Base64 alphabet."""
48
+ return b64decode_batch(items)
49
+
50
+
51
+ def standard_b64decode_batch_into(items, outputs: list[bytearray]) -> list[int]:
52
+ """Decode a list of standard Base64 inputs into reusable outputs."""
53
+ return b64decode_batch_into(items, outputs)
54
+
55
+
56
+ def urlsafe_b64encode_batch(items) -> list[bytes]:
57
+ """Encode a list of inputs with the URL-safe Base64 alphabet."""
58
+ return b64encode_batch(items, b'-_')
59
+
60
+
61
+ def urlsafe_b64encode_batch_into(items, outputs: list[bytearray]) -> list[int]:
62
+ """Encode a list of inputs with the URL-safe alphabet into reusable outputs."""
63
+ return b64encode_batch_into(items, outputs, b'-_')
64
+
65
+
66
+ def urlsafe_b64decode_batch(items) -> list[bytes]:
67
+ """Decode a list of inputs with the URL-safe Base64 alphabet."""
68
+ return b64decode_batch(items, b'-_')
69
+
70
+
71
+ def urlsafe_b64decode_batch_into(items, outputs: list[bytearray]) -> list[int]:
72
+ """Decode a list of URL-safe Base64 inputs into reusable outputs."""
73
+ return b64decode_batch_into(items, outputs, b'-_')
74
+
75
+
76
+ __all__ = [
77
+ 'b64decode',
78
+ 'b64decode_batch',
79
+ 'b64decode_batch_into',
80
+ 'b64decode_into',
81
+ 'b64encode',
82
+ 'b64encode_batch',
83
+ 'b64encode_batch_into',
84
+ 'b64encode_into',
85
+ 'standard_b64decode',
86
+ 'standard_b64decode_batch',
87
+ 'standard_b64decode_batch_into',
88
+ 'standard_b64decode_into',
89
+ 'standard_b64encode',
90
+ 'standard_b64encode_batch',
91
+ 'standard_b64encode_batch_into',
92
+ 'standard_b64encode_into',
93
+ 'urlsafe_b64decode',
94
+ 'urlsafe_b64decode_batch',
95
+ 'urlsafe_b64decode_batch_into',
96
+ 'urlsafe_b64decode_into',
97
+ 'urlsafe_b64encode',
98
+ 'urlsafe_b64encode_batch',
99
+ 'urlsafe_b64encode_batch_into',
100
+ 'urlsafe_b64encode_into',
101
+ ]
hashcodecs/base64.pyi ADDED
@@ -0,0 +1,69 @@
1
+ from _typeshed import ReadableBuffer
2
+
3
+ def b64encode(
4
+ s: ReadableBuffer,
5
+ altchars: ReadableBuffer | None = None,
6
+ *,
7
+ padded: bool = True,
8
+ wrapcol: int = 0,
9
+ ) -> bytes: ...
10
+ def b64encode_batch(items: list[ReadableBuffer], altchars: ReadableBuffer | None = None) -> list[bytes]: ...
11
+ def b64encode_batch_into(
12
+ items: list[ReadableBuffer],
13
+ outputs: list[bytearray],
14
+ altchars: ReadableBuffer | None = None,
15
+ ) -> list[int]: ...
16
+ def b64encode_into(
17
+ s: ReadableBuffer,
18
+ output: bytearray,
19
+ altchars: ReadableBuffer | None = None,
20
+ *,
21
+ padded: bool = True,
22
+ wrapcol: int = 0,
23
+ ) -> int: ...
24
+ def b64decode(
25
+ s: str | ReadableBuffer,
26
+ altchars: str | ReadableBuffer | None = None,
27
+ validate: bool = ...,
28
+ *,
29
+ padded: bool = True,
30
+ ignorechars: ReadableBuffer = ...,
31
+ canonical: bool = False,
32
+ ) -> bytes: ...
33
+ def b64decode_batch(
34
+ items: list[str | ReadableBuffer],
35
+ altchars: str | ReadableBuffer | None = None,
36
+ validate: bool = False,
37
+ ) -> list[bytes]: ...
38
+ def b64decode_batch_into(
39
+ items: list[str | ReadableBuffer],
40
+ outputs: list[bytearray],
41
+ altchars: str | ReadableBuffer | None = None,
42
+ validate: bool = False,
43
+ ) -> list[int]: ...
44
+ def b64decode_into(
45
+ s: str | ReadableBuffer,
46
+ output: bytearray,
47
+ altchars: str | ReadableBuffer | None = None,
48
+ validate: bool = ...,
49
+ *,
50
+ padded: bool = True,
51
+ ignorechars: ReadableBuffer = ...,
52
+ canonical: bool = False,
53
+ ) -> int: ...
54
+ def standard_b64encode(s: ReadableBuffer) -> bytes: ...
55
+ def standard_b64encode_batch(items: list[ReadableBuffer]) -> list[bytes]: ...
56
+ def standard_b64encode_batch_into(items: list[ReadableBuffer], outputs: list[bytearray]) -> list[int]: ...
57
+ def standard_b64encode_into(s: ReadableBuffer, output: bytearray) -> int: ...
58
+ def standard_b64decode(s: str | ReadableBuffer) -> bytes: ...
59
+ def standard_b64decode_batch(items: list[str | ReadableBuffer]) -> list[bytes]: ...
60
+ def standard_b64decode_batch_into(items: list[str | ReadableBuffer], outputs: list[bytearray]) -> list[int]: ...
61
+ def standard_b64decode_into(s: str | ReadableBuffer, output: bytearray) -> int: ...
62
+ def urlsafe_b64encode(s: ReadableBuffer, *, padded: bool = True) -> bytes: ...
63
+ def urlsafe_b64encode_batch(items: list[ReadableBuffer]) -> list[bytes]: ...
64
+ def urlsafe_b64encode_batch_into(items: list[ReadableBuffer], outputs: list[bytearray]) -> list[int]: ...
65
+ def urlsafe_b64encode_into(s: ReadableBuffer, output: bytearray, *, padded: bool = True) -> int: ...
66
+ def urlsafe_b64decode(s: str | ReadableBuffer, *, padded: bool = ...) -> bytes: ...
67
+ def urlsafe_b64decode_batch(items: list[str | ReadableBuffer]) -> list[bytes]: ...
68
+ def urlsafe_b64decode_batch_into(items: list[str | ReadableBuffer], outputs: list[bytearray]) -> list[int]: ...
69
+ def urlsafe_b64decode_into(s: str | ReadableBuffer, output: bytearray, *, padded: bool = ...) -> int: ...
hashcodecs/murmur3.py ADDED
@@ -0,0 +1,19 @@
1
+ """Fast one-shot and incremental MurmurHash3 functions."""
2
+
3
+ from ._hashcodecs import (
4
+ murmur3_32,
5
+ murmur3_x64_128,
6
+ murmur3_x64_128_digest,
7
+ murmur3_x86_32,
8
+ murmur3_x86_128,
9
+ murmur3_x86_128_digest,
10
+ )
11
+
12
+ __all__ = [
13
+ 'murmur3_32',
14
+ 'murmur3_x64_128',
15
+ 'murmur3_x64_128_digest',
16
+ 'murmur3_x86_32',
17
+ 'murmur3_x86_128',
18
+ 'murmur3_x86_128_digest',
19
+ ]
hashcodecs/py.typed ADDED
@@ -0,0 +1 @@
1
+
hashcodecs/xxhash.py ADDED
@@ -0,0 +1,5 @@
1
+ """Fast, canonical XXH3 hashes."""
2
+
3
+ from ._hashcodecs import xxh3_64, xxh3_64_batch, xxh3_128, xxh3_128_batch
4
+
5
+ __all__ = ['xxh3_64', 'xxh3_64_batch', 'xxh3_128', 'xxh3_128_batch']
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.5
2
+ Name: hashcodecs
3
+ Version: 0.6.0
4
+ Summary: SIMD-accelerated Base64, MurmurHash3, and xxHash codecs
5
+ License-Expression: MIT OR Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: LICENSE-MIT
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
16
+ Classifier: Programming Language :: Rust
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+
21
+ # hashcodecs
22
+
23
+ [![CI](https://img.shields.io/github/actions/workflow/status/kozistr/hashcodecs-rs/ci.yml?branch=main&style=for-the-badge&logo=github)](https://github.com/kozistr/hashcodecs-rs/actions/workflows/ci.yml)
24
+ [![Codecov](https://codecov.io/gh/kozistr/hashcodecs-rs/graph/badge.svg)](https://app.codecov.io/gh/kozistr/hashcodecs-rs)
25
+ [![PyPI](https://img.shields.io/pypi/v/hashcodecs?style=for-the-badge&logo=pypi)](https://pypi.org/project/hashcodecs/)
26
+ [![Python](https://img.shields.io/pypi/pyversions/hashcodecs?style=for-the-badge&logo=python)](https://pypi.org/project/hashcodecs/)
27
+ [![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-brightgreen?style=for-the-badge)](https://github.com/kozistr/hashcodecs-rs#license)
28
+ [![Downloads](https://img.shields.io/pypi/dm/hashcodecs?style=for-the-badge&label=downloads)](https://pypi.org/project/hashcodecs/)
29
+
30
+ `hashcodecs` provides runtime-dispatched SIMD Base64 codecs and fast, reference-compatible MurmurHash3 and XXH3 functions for Rust and Python.
31
+
32
+ ## Design
33
+
34
+ - Runtime-dispatched SIMD Base64 with portable scalar fallbacks.
35
+ - Reference-compatible MurmurHash3 with SIMD acceleration.
36
+ - Bit-for-bit compatible XXH3-64 and XXH3-128 with runtime SIMD dispatch and native batch APIs.
37
+ - Rust and Python `*_into` APIs for caller-managed output buffers.
38
+ - A familiar Python Base64 API, including native batch encode and decode operations.
39
+ - Unsafe paths verified with Kani, strict-provenance Miri, ASan/MSan, and differential fuzzing.
40
+
41
+ ## Install
42
+
43
+ ```
44
+ pip3 install hashcodecs
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ### Rust
50
+
51
+ ```rust
52
+ let encoded = hashcodecs::b64encode(b"hello");
53
+ assert_eq!(encoded, "aGVsbG8=");
54
+
55
+ let mut output = [0_u8; 8];
56
+ let written = hashcodecs::b64encode_into(b"hello", &mut output).unwrap();
57
+ assert_eq!(&output[..written], b"aGVsbG8=");
58
+ assert_eq!(hashcodecs::murmur3_x86_32(b"hello", 0), 0x248b_fa47);
59
+ assert_eq!(hashcodecs::xxh3_64(b"", 0), 0x2d06_8005_38d3_94c2);
60
+ ```
61
+
62
+ ### Python
63
+
64
+ ```python
65
+ import hashcodecs.base64 as base64
66
+ from hashcodecs import murmur3_32, murmur3_x64_128, xxh3_64, xxh3_128_batch
67
+
68
+ assert base64.b64encode(b'hello') == b'aGVsbG8='
69
+ assert base64.b64decode(b'aGVsbG8=') == b'hello'
70
+ assert base64.b64encode_batch([b'hello', b'world']) == [b'aGVsbG8=', b'd29ybGQ=']
71
+ assert base64.b64decode_batch([b'aGVsbG8=', 'd29ybGQ=']) == [b'hello', b'world']
72
+ assert base64.b64encode(b'hello', padded=False) == b'aGVsbG8'
73
+ assert base64.b64decode(b'aGVsbG8', padded=False, canonical=True) == b'hello'
74
+ assert murmur3_32(b'hello') == 0x248BFA47
75
+ assert xxh3_64(b'') == 0x2D06800538D394C2
76
+ assert xxh3_128_batch([b'hello', b'world']) == [
77
+ 0xB5E9C1AD071B3E7FC779CFAA5E523818,
78
+ 0xFA0D38A9B38280D0891E4985BDB2583E,
79
+ ]
80
+
81
+ payload = b'hello'
82
+ encoded = bytearray(4 * ((len(payload) + 2) // 3))
83
+ encoded_len = base64.b64encode_into(payload, encoded)
84
+ decoded = bytearray(len(encoded))
85
+ decoded_len = base64.b64decode_into(encoded, decoded, validate=True)
86
+ assert encoded[:encoded_len] == b'aGVsbG8='
87
+ assert decoded[:decoded_len] == payload
88
+
89
+ hasher = murmur3_x64_128(seed=42)
90
+ hasher.update(b'hello')
91
+ assert hasher.hexdigest() == hasher.digest().hex()
92
+ ```
93
+
94
+ Build an installable wheel and source distribution with:
95
+
96
+ ```sh
97
+ uv build
98
+ ```
99
+
100
+ # Benchmark
101
+
102
+ Environment: Windows 10 x64 and Intel Core Ultra 7 265K.
103
+
104
+ Conditions: clean builds, one pinned logical CPU, single-threaded execution, 50 Rust samples, and 15 Python samples. Returned-output allocation is included except in the reusable-buffer table. Higher is better.
105
+
106
+ ## Run Locally
107
+
108
+ Comparison crates are development-only dependencies and are not included in consumer builds.
109
+
110
+ ```sh
111
+ cargo bench --bench base64
112
+ cargo bench --bench murmur3
113
+ cargo bench --bench xxhash
114
+ uv sync --group benchmark --no-install-project
115
+ uv run --no-project --with . python benchmarks/python_base64.py
116
+ uv run --no-project --with . python benchmarks/python_base64.py --into
117
+ uv run --no-project --with . python benchmarks/python_base64.py --bytearray-input
118
+ uv run --no-project --with . python benchmarks/python_base64.py --memoryview-input
119
+ uv run --no-project --with . python benchmarks/python_base64_batch.py
120
+ uv run --no-project --with . python benchmarks/python_base64_batch.py --large
121
+ uv run --no-project --with . python benchmarks/python_murmur3.py
122
+ uv run --no-project --with . python benchmarks/python_murmur3.py --incremental
123
+ uv run --no-project --with . python benchmarks/python_xxhash.py
124
+ ```
125
+
126
+ For regression checks that do not need fresh competitor measurements, pass
127
+ `--hashcodecs-only` to any Python benchmark command.
128
+
129
+ For the same-ISA Windows comparison reported below, rebuild the C baseline with
130
+ `$env:CFLAGS='/O2 /arch:AVX2'; cargo clean -p xxhash-c-sys; cargo bench --bench xxhash`.
131
+
132
+ ## Base64: Rust
133
+
134
+ [![Rust Base64 throughput](docs/benchmarks/base64-rust.svg)](docs/benchmarks/base64-rust.svg)
135
+
136
+ ## MurmurHash3: Rust
137
+
138
+ [![Rust MurmurHash3 throughput](docs/benchmarks/murmur3-rust.svg)](docs/benchmarks/murmur3-rust.svg)
139
+
140
+ ## XXH3: Rust
141
+
142
+ `upstream C` is xxHash 0.8.3 built through `xxhash-c-sys` with AVX2 enabled, matching the backend selected by hashcodecs on the benchmark host. Batch results hash 32 equal-size inputs and include result-vector allocation.
143
+
144
+ [![Rust XXH3 throughput](docs/benchmarks/xxh3-rust.svg)](docs/benchmarks/xxh3-rust.svg)
145
+
146
+ ## Base64: Python
147
+
148
+ Python decoding uses `validate=True`, and `hashcodecs` passes `bytes` directly into Rust without an input copy.
149
+
150
+ [![Python Base64 throughput](docs/benchmarks/base64-python.svg)](docs/benchmarks/base64-python.svg)
151
+
152
+ ## MurmurHash3: Python
153
+
154
+ [![Python MurmurHash3 throughput](docs/benchmarks/murmur3-python.svg)](docs/benchmarks/murmur3-python.svg)
155
+
156
+ ## XXH3: Python
157
+
158
+ The batch comparison uses one native `hashcodecs` call versus a loop over the upstream `xxhash` extension.
159
+
160
+ [![Python XXH3 throughput](docs/benchmarks/xxh3-python.svg)](docs/benchmarks/xxh3-python.svg)
161
+
162
+ Reusable-buffer and mutable-input charts are available in [BENCHMARK.md](BENCHMARK.md). Exact chart values are
163
+ available as [CSV](docs/benchmarks/results.csv).
164
+
165
+ ## SIMD References
166
+
167
+ The SIMD implementation follows the approach described in [Faster Base64 Encoding and Decoding using AVX2 Instructions](https://arxiv.org/abs/1704.00605), with AVX-512 VBMI and AArch64 NEON backends selected automatically when available.
@@ -0,0 +1,13 @@
1
+ hashcodecs/__init__.py,sha256=Y7__NNxrOVeK2FnWS3bmlidlqKi4pOaLfELfUIwqBis,1932
2
+ hashcodecs/_hashcodecs.pyi,sha256=ebWZNDyeVphQS-Et7fD6jo-UlX_eI4zCfyFaBrVAjuI,4012
3
+ hashcodecs/base64.py,sha256=PSc8LcoMflcpWNl8JXK3SmDige8NwPv8XFG_ZSF0ATI,3036
4
+ hashcodecs/base64.pyi,sha256=CRqODyOTpAhThxpnUp2LRxjlZ2lUJ6-xClj5_py9K2U,2960
5
+ hashcodecs/murmur3.py,sha256=mf0_lokhs7OXcVVNRtul2ANx-J15yDA0UEGUJ_hHdFI,403
6
+ hashcodecs/py.typed,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
7
+ hashcodecs/xxhash.py,sha256=3zv8-mJwtdmCexPKIkgh32HvyfiFfnb76GZymBa2ioc,185
8
+ hashcodecs/_hashcodecs.pyd,sha256=Z2aDsKwM2PIAgkav63Gu7tUqpvT7Q7pC5M3wcW5ND1Q,620544
9
+ hashcodecs-0.6.0.dist-info/METADATA,sha256=RGovK9lCpFc5-s2SWOFJerH03wsyNIuzCcjOcQXERkY,7019
10
+ hashcodecs-0.6.0.dist-info/WHEEL,sha256=EV7sIknSbGBGcz9dqk1_tXuUPXCFIJdjax3AsEYej2M,97
11
+ hashcodecs-0.6.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
12
+ hashcodecs-0.6.0.dist-info/licenses/LICENSE-MIT,sha256=wbKBEysw7bQIrPaWh4Du_u4XL_tMzLvStzCLJ_D6s14,1101
13
+ hashcodecs-0.6.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: false
4
+ Tag: cp315-cp315-win_amd64
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hashcodecs contributors
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.