spookyhash 2.1.0__tar.gz → 2.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.
- {spookyhash-2.1.0 → spookyhash-2.1.2}/LICENSE +21 -21
- {spookyhash-2.1.0 → spookyhash-2.1.2}/MANIFEST.in +1 -1
- {spookyhash-2.1.0/spookyhash.egg-info → spookyhash-2.1.2}/PKG-INFO +123 -110
- {spookyhash-2.1.0 → spookyhash-2.1.2}/README.md +89 -89
- spookyhash-2.1.2/pyproject.toml +56 -0
- {spookyhash-2.1.0 → spookyhash-2.1.2}/setup.cfg +4 -4
- spookyhash-2.1.2/setup.py +23 -0
- spookyhash-2.1.0/spookyhash.py → spookyhash-2.1.2/spookyhash/__init__.py +243 -240
- spookyhash-2.1.2/spookyhash/_spookyhash.pyi +25 -0
- spookyhash-2.1.2/spookyhash/py.typed +0 -0
- {spookyhash-2.1.0 → spookyhash-2.1.2/spookyhash.egg-info}/PKG-INFO +123 -110
- {spookyhash-2.1.0 → spookyhash-2.1.2}/spookyhash.egg-info/SOURCES.txt +7 -3
- spookyhash-2.1.2/spookyhash.egg-info/requires.txt +11 -0
- spookyhash-2.1.2/spookyhash.egg-info/top_level.txt +1 -0
- {spookyhash-2.1.0 → spookyhash-2.1.2}/src/SpookyV2.cpp +351 -351
- {spookyhash-2.1.0 → spookyhash-2.1.2}/src/SpookyV2.h +299 -299
- {spookyhash-2.1.0 → spookyhash-2.1.2}/src/SpookyV2.pxd +12 -12
- {spookyhash-2.1.0 → spookyhash-2.1.2}/src/spookyhash.pyx +106 -99
- spookyhash-2.1.2/tests/test_readme.py +50 -0
- spookyhash-2.1.2/tests/test_release.py +25 -0
- spookyhash-2.1.2/tests/test_spooky_hash.py +363 -0
- spookyhash-2.1.0/pyproject.toml +0 -37
- spookyhash-2.1.0/setup.py +0 -19
- spookyhash-2.1.0/spookyhash.egg-info/requires.txt +0 -4
- spookyhash-2.1.0/spookyhash.egg-info/top_level.txt +0 -2
- spookyhash-2.1.0/src/spookyhash.cpp +0 -24569
- {spookyhash-2.1.0 → spookyhash-2.1.2}/spookyhash.egg-info/dependency_links.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Alen Buhanec
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Alen Buhanec
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
include src/*.pyx src/*.pxd src/*.cpp src/*.h
|
|
1
|
+
include src/*.pyx src/*.pxd src/*.cpp src/*.h
|
|
@@ -1,110 +1,123 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name: spookyhash
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary: A Python wrapper for SpookyHash version 2
|
|
5
|
-
Author-email: Alen
|
|
6
|
-
License: MIT
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Classifier:
|
|
12
|
-
Classifier:
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.
|
|
15
|
-
Classifier:
|
|
16
|
-
Classifier:
|
|
17
|
-
Classifier:
|
|
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
|
-
>>> spookyhash.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
>>>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
>>>
|
|
70
|
-
>>>
|
|
71
|
-
|
|
72
|
-
>>>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
>>> sh
|
|
84
|
-
>>> sh.update(b'
|
|
85
|
-
>>> sh.final()
|
|
86
|
-
|
|
87
|
-
>>> sh.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
'
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
>>>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spookyhash
|
|
3
|
+
Version: 2.1.2
|
|
4
|
+
Summary: A Python wrapper for SpookyHash version 2
|
|
5
|
+
Author-email: Alen Buhanec <alen.buhanec@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/buhanec/spookyhash
|
|
8
|
+
Project-URL: Repository, https://github.com/buhanec/spookyhash
|
|
9
|
+
Project-URL: Issues, https://github.com/buhanec/spookyhash/issues
|
|
10
|
+
Keywords: SpookyHash,hashlib
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: typing
|
|
27
|
+
Requires-Dist: mypy>=1.18; extra == "typing"
|
|
28
|
+
Requires-Dist: typing-extensions; extra == "typing"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest; extra == "test"
|
|
31
|
+
Requires-Dist: hypothesis; extra == "test"
|
|
32
|
+
Requires-Dist: numpy; (python_version >= "3.11" or sys_platform != "win32" or platform_machine != "ARM64") and extra == "test"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# spookyhash
|
|
36
|
+
|
|
37
|
+
A Python wrapper of Bob Jenkins' [SpookyHash version 2](http://burtleburtle.net/bob/hash/spooky.html). Offers 32- 64- and 128-bit oneshot and incremental hashes.
|
|
38
|
+
|
|
39
|
+
# License
|
|
40
|
+
|
|
41
|
+
> Licensed under the MIT license. See the LICENSE file in the repository root for more details.
|
|
42
|
+
|
|
43
|
+
# Usage
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
Available through [spookyhash - PyPI](https://pypi.org/project/spookyhash/) using `pip install spookyhash`.
|
|
48
|
+
|
|
49
|
+
## Oneshot Hashes
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
>>> import spookyhash
|
|
53
|
+
|
|
54
|
+
>>> spookyhash.hash32(b'hello world')
|
|
55
|
+
2617184861
|
|
56
|
+
>>> spookyhash.hash32(b'hello world', seed=0x12345678)
|
|
57
|
+
3380090220
|
|
58
|
+
|
|
59
|
+
>>> spookyhash.hash64(b'hello world')
|
|
60
|
+
14865987102431973981
|
|
61
|
+
>>> spookyhash.hash64(b'hello world', seed=123)
|
|
62
|
+
5719863273689036421
|
|
63
|
+
|
|
64
|
+
>>> spookyhash.hash128(b'hello world')
|
|
65
|
+
185933735475381961281710998418114941533
|
|
66
|
+
>>> spookyhash.hash128(b'hello world', seed1=123_000, seed2=456_000)
|
|
67
|
+
144121310386202441278894605216246194925
|
|
68
|
+
|
|
69
|
+
>>> # For a more comparable result to other libraries
|
|
70
|
+
>>> spookyhash.hash128_pair(b'hello world')
|
|
71
|
+
(14865987102431973981, 10079487997037711397)
|
|
72
|
+
>>> spookyhash.hash128_pair(b'hello world', seed1=123_000, seed2=456_000)
|
|
73
|
+
(12678109464562819821, 7812831891108919044)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Incremental Hashes
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
>>> import spookyhash
|
|
80
|
+
|
|
81
|
+
>>> sh = spookyhash.Hash32()
|
|
82
|
+
>>> sh.update(b'hello')
|
|
83
|
+
>>> sh.update(b' ')
|
|
84
|
+
>>> sh.update(b'world')
|
|
85
|
+
>>> sh.final()
|
|
86
|
+
2617184861
|
|
87
|
+
>>> sh.hexdigest()
|
|
88
|
+
'5d12ff9b'
|
|
89
|
+
|
|
90
|
+
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').final()
|
|
91
|
+
5719863273689036421
|
|
92
|
+
|
|
93
|
+
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').hexdigest()
|
|
94
|
+
'85b609a05709614f'
|
|
95
|
+
|
|
96
|
+
>>> sh = spookyhash.Hash128(seed1=123_000, seed2=456_000)
|
|
97
|
+
>>> sh.update(b'hello world')
|
|
98
|
+
>>> sh.final()
|
|
99
|
+
144121310386202441278894605216246194925
|
|
100
|
+
>>> sh.final_pair()
|
|
101
|
+
(12678109464562819821, 7812831891108919044)
|
|
102
|
+
>>> sh.hexdigest()
|
|
103
|
+
'ede2c8f262b1f1af04f763f735c16c6c'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## `memoryview` Support
|
|
107
|
+
|
|
108
|
+
Includes `memoryview` compatible types, such as NumPy arrays.
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
>>> import spookyhash
|
|
112
|
+
>>> import numpy as np
|
|
113
|
+
|
|
114
|
+
>>> spookyhash.Hash64(np.arange(100, dtype=np.int32)).hexdigest()
|
|
115
|
+
'43ab5363ad362c74'
|
|
116
|
+
|
|
117
|
+
>>> spookyhash.Hash64(memoryview(b'hello world')).hexdigest()
|
|
118
|
+
'5d12ff9b81984ece'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
# Platform Independence
|
|
122
|
+
|
|
123
|
+
If run on a big-endian system, the code would produce different hashes, but of equal quality.
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
# spookyhash
|
|
2
|
-
|
|
3
|
-
A Python wrapper of Bob Jenkins' [SpookyHash version 2](http://burtleburtle.net/bob/hash/spooky.html). Offers 32- 64- and 128-bit oneshot and incremental hashes.
|
|
4
|
-
|
|
5
|
-
# License
|
|
6
|
-
|
|
7
|
-
> Licensed under the MIT license. See the LICENSE file in the repository root for more details.
|
|
8
|
-
|
|
9
|
-
# Usage
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
Available through [spookyhash - PyPI](https://pypi.org/project/spookyhash/) using `pip install spookyhash`.
|
|
14
|
-
|
|
15
|
-
## Oneshot Hashes
|
|
16
|
-
|
|
17
|
-
```python
|
|
18
|
-
>>> import spookyhash
|
|
19
|
-
|
|
20
|
-
>>> spookyhash.hash32(b'hello world')
|
|
21
|
-
2617184861
|
|
22
|
-
>>> spookyhash.hash32(b'hello world', seed=0x12345678)
|
|
23
|
-
3380090220
|
|
24
|
-
|
|
25
|
-
>>> spookyhash.hash64(b'hello world')
|
|
26
|
-
14865987102431973981
|
|
27
|
-
>>> spookyhash.hash64(b'hello world', seed=123)
|
|
28
|
-
5719863273689036421
|
|
29
|
-
|
|
30
|
-
>>> spookyhash.hash128(b'hello world')
|
|
31
|
-
185933735475381961281710998418114941533
|
|
32
|
-
>>> spookyhash.hash128(b'hello world', seed1=123_000, seed2=456_000)
|
|
33
|
-
144121310386202441278894605216246194925
|
|
34
|
-
|
|
35
|
-
>>> # For a more comparable result to other libraries
|
|
36
|
-
>>> spookyhash.hash128_pair(b'hello world')
|
|
37
|
-
(14865987102431973981, 10079487997037711397)
|
|
38
|
-
>>> spookyhash.hash128_pair(b'hello world', seed1=123_000, seed2=456_000)
|
|
39
|
-
(12678109464562819821, 7812831891108919044)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Incremental Hashes
|
|
43
|
-
|
|
44
|
-
```python
|
|
45
|
-
>>> import spookyhash
|
|
46
|
-
|
|
47
|
-
>>> sh = spookyhash.Hash32()
|
|
48
|
-
>>> sh.update(b'hello')
|
|
49
|
-
>>> sh.update(b' ')
|
|
50
|
-
>>> sh.update(b'world')
|
|
51
|
-
>>> sh.final()
|
|
52
|
-
2617184861
|
|
53
|
-
>>> sh.hexdigest()
|
|
54
|
-
'5d12ff9b'
|
|
55
|
-
|
|
56
|
-
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').final()
|
|
57
|
-
5719863273689036421
|
|
58
|
-
|
|
59
|
-
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').hexdigest()
|
|
60
|
-
'85b609a05709614f'
|
|
61
|
-
|
|
62
|
-
>>> sh = spookyhash.Hash128(seed1=123_000, seed2=456_000)
|
|
63
|
-
>>> sh.update(b'hello world')
|
|
64
|
-
>>> sh.final()
|
|
65
|
-
144121310386202441278894605216246194925
|
|
66
|
-
>>> sh.final_pair()
|
|
67
|
-
(12678109464562819821, 7812831891108919044)
|
|
68
|
-
>>> sh.hexdigest()
|
|
69
|
-
'ede2c8f262b1f1af04f763f735c16c6c'
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## `memoryview` Support
|
|
73
|
-
|
|
74
|
-
Includes `memoryview` compatible types, such as NumPy arrays.
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
>>> import spookyhash
|
|
78
|
-
>>> import numpy as np
|
|
79
|
-
|
|
80
|
-
>>> spookyhash.Hash64(np.arange(100)).hexdigest()
|
|
81
|
-
'43ab5363ad362c74'
|
|
82
|
-
|
|
83
|
-
>>> spookyhash.Hash64(memoryview(b'hello world')).hexdigest()
|
|
84
|
-
'5d12ff9b81984ece'
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
# Platform Independence
|
|
88
|
-
|
|
89
|
-
If run on a big-endian system, the code would produce different hashes, but of equal quality.
|
|
1
|
+
# spookyhash
|
|
2
|
+
|
|
3
|
+
A Python wrapper of Bob Jenkins' [SpookyHash version 2](http://burtleburtle.net/bob/hash/spooky.html). Offers 32- 64- and 128-bit oneshot and incremental hashes.
|
|
4
|
+
|
|
5
|
+
# License
|
|
6
|
+
|
|
7
|
+
> Licensed under the MIT license. See the LICENSE file in the repository root for more details.
|
|
8
|
+
|
|
9
|
+
# Usage
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Available through [spookyhash - PyPI](https://pypi.org/project/spookyhash/) using `pip install spookyhash`.
|
|
14
|
+
|
|
15
|
+
## Oneshot Hashes
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
>>> import spookyhash
|
|
19
|
+
|
|
20
|
+
>>> spookyhash.hash32(b'hello world')
|
|
21
|
+
2617184861
|
|
22
|
+
>>> spookyhash.hash32(b'hello world', seed=0x12345678)
|
|
23
|
+
3380090220
|
|
24
|
+
|
|
25
|
+
>>> spookyhash.hash64(b'hello world')
|
|
26
|
+
14865987102431973981
|
|
27
|
+
>>> spookyhash.hash64(b'hello world', seed=123)
|
|
28
|
+
5719863273689036421
|
|
29
|
+
|
|
30
|
+
>>> spookyhash.hash128(b'hello world')
|
|
31
|
+
185933735475381961281710998418114941533
|
|
32
|
+
>>> spookyhash.hash128(b'hello world', seed1=123_000, seed2=456_000)
|
|
33
|
+
144121310386202441278894605216246194925
|
|
34
|
+
|
|
35
|
+
>>> # For a more comparable result to other libraries
|
|
36
|
+
>>> spookyhash.hash128_pair(b'hello world')
|
|
37
|
+
(14865987102431973981, 10079487997037711397)
|
|
38
|
+
>>> spookyhash.hash128_pair(b'hello world', seed1=123_000, seed2=456_000)
|
|
39
|
+
(12678109464562819821, 7812831891108919044)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Incremental Hashes
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
>>> import spookyhash
|
|
46
|
+
|
|
47
|
+
>>> sh = spookyhash.Hash32()
|
|
48
|
+
>>> sh.update(b'hello')
|
|
49
|
+
>>> sh.update(b' ')
|
|
50
|
+
>>> sh.update(b'world')
|
|
51
|
+
>>> sh.final()
|
|
52
|
+
2617184861
|
|
53
|
+
>>> sh.hexdigest()
|
|
54
|
+
'5d12ff9b'
|
|
55
|
+
|
|
56
|
+
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').final()
|
|
57
|
+
5719863273689036421
|
|
58
|
+
|
|
59
|
+
>>> spookyhash.Hash64(b'hello ', seed=123).update(b'world').hexdigest()
|
|
60
|
+
'85b609a05709614f'
|
|
61
|
+
|
|
62
|
+
>>> sh = spookyhash.Hash128(seed1=123_000, seed2=456_000)
|
|
63
|
+
>>> sh.update(b'hello world')
|
|
64
|
+
>>> sh.final()
|
|
65
|
+
144121310386202441278894605216246194925
|
|
66
|
+
>>> sh.final_pair()
|
|
67
|
+
(12678109464562819821, 7812831891108919044)
|
|
68
|
+
>>> sh.hexdigest()
|
|
69
|
+
'ede2c8f262b1f1af04f763f735c16c6c'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## `memoryview` Support
|
|
73
|
+
|
|
74
|
+
Includes `memoryview` compatible types, such as NumPy arrays.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
>>> import spookyhash
|
|
78
|
+
>>> import numpy as np
|
|
79
|
+
|
|
80
|
+
>>> spookyhash.Hash64(np.arange(100, dtype=np.int32)).hexdigest()
|
|
81
|
+
'43ab5363ad362c74'
|
|
82
|
+
|
|
83
|
+
>>> spookyhash.Hash64(memoryview(b'hello world')).hexdigest()
|
|
84
|
+
'5d12ff9b81984ece'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
# Platform Independence
|
|
88
|
+
|
|
89
|
+
If run on a big-endian system, the code would produce different hashes, but of equal quality.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=77",
|
|
4
|
+
"cython>=3.1",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
authors = [{name = "Alen Buhanec", email = "alen.buhanec@gmail.com"}]
|
|
10
|
+
name = "spookyhash"
|
|
11
|
+
description = "A Python wrapper for SpookyHash version 2"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
keywords = ["SpookyHash", "hashlib"]
|
|
15
|
+
license = "MIT"
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Programming Language :: Python :: 3.15",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
dynamic = ["version"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/buhanec/spookyhash"
|
|
34
|
+
Repository = "https://github.com/buhanec/spookyhash"
|
|
35
|
+
Issues = "https://github.com/buhanec/spookyhash/issues"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
typing = [
|
|
39
|
+
"mypy>=1.18",
|
|
40
|
+
"typing-extensions",
|
|
41
|
+
]
|
|
42
|
+
test = [
|
|
43
|
+
"pytest",
|
|
44
|
+
"hypothesis",
|
|
45
|
+
# only publishes win_arm64 wheels for CPython 3.11+
|
|
46
|
+
"numpy; python_version >= '3.11' or sys_platform != 'win32' or platform_machine != 'ARM64'",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
packages = ["spookyhash"]
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.package-data]
|
|
53
|
+
spookyhash = ["py.typed", "_spookyhash.pyi"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.dynamic]
|
|
56
|
+
version = {attr = "spookyhash.__version__"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from Cython.Build import cythonize
|
|
2
|
+
from setuptools import Extension, setup
|
|
3
|
+
|
|
4
|
+
setup(
|
|
5
|
+
ext_modules=cythonize(
|
|
6
|
+
[
|
|
7
|
+
Extension(
|
|
8
|
+
"spookyhash._spookyhash",
|
|
9
|
+
["src/spookyhash.pyx", "src/SpookyV2.cpp"],
|
|
10
|
+
language="c++",
|
|
11
|
+
),
|
|
12
|
+
],
|
|
13
|
+
compiler_directives={
|
|
14
|
+
"cdivision": True,
|
|
15
|
+
"boundscheck": False,
|
|
16
|
+
"wraparound": False,
|
|
17
|
+
"embedsignature": True,
|
|
18
|
+
"language_level": 3,
|
|
19
|
+
"freethreading_compatible": True,
|
|
20
|
+
},
|
|
21
|
+
build_dir="build/cython",
|
|
22
|
+
),
|
|
23
|
+
)
|