Skip to content

Commit ce573f9

Browse files
authored
Add buffer argument to hasher constructors (#83)
1 parent 3d8bd8f commit ce573f9

File tree

8 files changed

+287
-186
lines changed

8 files changed

+287
-186
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ This project has adhered to
2525
- Change the format of CHANGELOG.md to conform to the
2626
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) standard
2727
([#63](https://github.com/hajimes/mmh3/issues/63)).
28+
- **Backward-incompatible**: Change the constructors of hasher classes to
29+
accept a buffer as the first argument.
2830

2931
### Fixed
3032

3133
- Fix a reference leak in the `hash_from_buffer()` function
3234
([#75](https://github.com/hajimes/mmh3/issues/75)).
33-
- Fix type hints.
35+
- Fix type hints ([#76](https://github.com/hajimes/mmh3/issues/76),
36+
[#77](https://github.com/hajimes/mmh3/issues/77)).
3437

3538
## [4.1.0] - 2024-01-09
3639

README.md

+8-15
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,15 @@ complete changelog.
150150
- Change the format of CHANGELOG.md to conform to the
151151
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) standard
152152
([#63](https://github.com/hajimes/mmh3/issues/63)).
153+
- **Backward-incompatible**: Change the constructors of hasher classes to
154+
accept a buffer as the first argument.
153155

154156
#### Fixed
155157

156158
- Fix a reference leak in the `hash_from_buffer()` function
157159
([#75](https://github.com/hajimes/mmh3/issues/75)).
158-
- Fix type hints.
160+
- Fix type hints ([#76](https://github.com/hajimes/mmh3/issues/76),
161+
[#77](https://github.com/hajimes/mmh3/issues/77)).
159162

160163
### [4.1.0] - 2024-01-09
161164

@@ -166,20 +169,11 @@ complete changelog.
166169
#### Fixed
167170

168171
- Fix issues with Bazel by changing the directory structure of the project
169-
(<https://github.com/hajimes/mmh3/issues/50>).
170-
- Fix incorrect type hints (<https://github.com/hajimes/mmh3/issues/51>).
172+
([#50](https://github.com/hajimes/mmh3/issues/50)).
173+
- Fix incorrect type hints ([#51](https://github.com/hajimes/mmh3/issues/51)).
171174
- Fix invalid results on s390x when the arg `x64arch` of `hash64` or
172-
`hash_bytes` is set to `False` (<https://github.com/hajimes/mmh3/issues/52>).
173-
174-
### [4.0.1] - 2023-07-14
175-
176-
#### Changed
177-
178-
- Refactor the project structure (<https://github.com/hajimes/mmh3/issues/48>).
179-
180-
#### Fixed
181-
182-
- Fix incorrect type hints.
175+
`hash_bytes` is set to `False`
176+
([#52](https://github.com/hajimes/mmh3/issues/52)).
183177

184178
## License
185179

@@ -300,4 +294,3 @@ is useful for OSINT and cybersecurity activities.
300294

301295
[unreleased]: https://github.com/hajimes/mmh3/compare/v4.1.0...HEAD
302296
[4.1.0]: https://github.com/hajimes/mmh3/compare/v4.0.1...v4.1.0
303-
[4.0.1]: https://github.com/hajimes/mmh3/compare/v4.0.0...v4.0.1

docs/CONTRIBUTING.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ to see if the problem has already been noted.
2020

2121
## Project structure
2222

23-
As of version 4.2.0, the project layout is structured as follows:
23+
As of version 5.0.0-dev, the project layout is structured as follows:
2424

2525
- `src/mmh3`
2626
- `mmh3module.c`: the main file that serves as the interface between Python
@@ -102,6 +102,14 @@ by Python.
102102
by Simon Willison is a good introduction to Docker/QEMU settings for emulating
103103
s390x.
104104

105+
If the above does not work, you may also want to try the following:
106+
107+
```shell
108+
docker run --rm --privileged tonistiigi/binfmt --install all
109+
docker buildx create --name mybuilder --use
110+
docker run -it multiarch/ubuntu-core:s390x-focal /bin/bash
111+
```
112+
105113
## Pull request
106114

107115
Once you've pushed your changes to your fork, you can
@@ -160,7 +168,7 @@ For example,
160168
pip install ".[benchmark]"
161169
mkdir results
162170
python benchmark/benchmark.py -o results/mmh3_128.json \
163-
--test-hash mmh3_128 --test-buffer-size-max 134217728
171+
--test-hash mmh3_128 --test-buffer-size-max 262144
164172
```
165173

166174
As of version 4.2.0, the following hash function identifiers are available for

docs/api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# API Reference
22

33
```{caution}
4-
This reference contains functions that are not yet released in the stable
5-
version.
4+
This reference contains functions and APIs that are not yet released in the
5+
stable version (4.1.0).
66
```
77

88
## Functions for immutables

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "mmh3"
8-
version = "4.2.0-alpha.4"
8+
version = "5.0.0-dev.1"
99
description = "Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions."
1010
readme = "README.md"
1111
license = {file = "LICENSE"}

src/mmh3/__init__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def mmh3_x86_128_utupledigest(
4545
) -> tuple[int, int]: ...
4646

4747
class Hasher:
48-
def __init__(self, seed: int = 0) -> None: ...
48+
def __init__(self, data: Union[Buffer, None] = None, seed: int = 0) -> None: ...
4949
def update(self, data: Buffer) -> None: ...
5050
def digest(self) -> bytes: ...
5151
def sintdigest(self) -> int: ...

0 commit comments

Comments
 (0)