1
- def gxhash32 (input_bytes : bytes , seed : int ) -> int :
1
+ from typing import BinaryIO
2
+
3
+ def gxhash32 (file : BinaryIO , seed : int ) -> int :
2
4
"""
3
5
Summary
4
6
-------
@@ -7,28 +9,29 @@ def gxhash32(input_bytes: bytes, seed: int) -> int:
7
9
8
10
Parameters
9
11
----------
10
- input_bytes (bytes): input bytes to hash
12
+ file (BinaryIO)
13
+ file-like object
11
14
12
- seed (int): seed for the hash function
15
+ seed (int)
16
+ seed for the hash function
13
17
14
18
15
19
Returns
16
20
-------
17
- hash (int): u32 hash of the input bytes
21
+ hash (int)
22
+ u32 hash of the input bytes
18
23
19
24
20
25
Example
21
26
-------
22
27
```python
23
- import gxhash
24
-
25
- input_bytes = bytes([42] * 1000)
28
+ file = BytesIO(bytes([42] * 1000))
26
29
seed = 1234
27
- print(f"Hash is {gxhash.gxhash32(input_bytes , seed)}!")
30
+ print(f"Hash is {gxhash.gxhash32(file , seed)}!")
28
31
```
29
32
"""
30
33
31
- def gxhash32_nogil ( input_bytes : bytes , seed : int ) -> int :
34
+ async def gxhash32_async ( file : BinaryIO , seed : int ) -> int :
32
35
"""
33
36
Summary
34
37
-------
@@ -37,28 +40,29 @@ def gxhash32_nogil(input_bytes: bytes, seed: int) -> int:
37
40
38
41
Parameters
39
42
----------
40
- input_bytes (bytes): input bytes to hash
43
+ file (BinaryIO)
44
+ file-like object
41
45
42
- seed (int): seed for the hash function
46
+ seed (int)
47
+ seed for the hash function
43
48
44
49
45
50
Returns
46
51
-------
47
- hash (int): u32 hash of the input bytes
52
+ hash (Awaitable[int])
53
+ u32 hash of the input bytes
48
54
49
55
50
56
Example
51
57
-------
52
58
```python
53
- import gxhash
54
-
55
- input_bytes = bytes([42] * 1000)
59
+ file = BytesIO(bytes([42] * 1000))
56
60
seed = 1234
57
- print(f"Hash is {gxhash.gxhash32_nogil(input_bytes , seed)}!")
61
+ print(f"Hash is {gxhash.gxhash32_async(file , seed)}!")
58
62
```
59
63
"""
60
64
61
- def gxhash64 (input_bytes : bytes , seed : int ) -> int :
65
+ def gxhash64 (file : BinaryIO , seed : int ) -> int :
62
66
"""
63
67
Summary
64
68
-------
@@ -67,28 +71,29 @@ def gxhash64(input_bytes: bytes, seed: int) -> int:
67
71
68
72
Parameters
69
73
----------
70
- input_bytes (bytes): input bytes to hash
74
+ file (BinaryIO)
75
+ file-like object
71
76
72
- seed (int): seed for the hash function
77
+ seed (int)
78
+ seed for the hash function
73
79
74
80
75
81
Returns
76
82
-------
77
- hash (int): u64 hash of the input bytes
83
+ hash (int)
84
+ u64 hash of the input bytes
78
85
79
86
80
87
Example
81
88
-------
82
89
```python
83
- import gxhash
84
-
85
- input_bytes = bytes([42] * 1000)
90
+ file = BytesIO(bytes([42] * 1000))
86
91
seed = 1234
87
- print(f"Hash is {gxhash.gxhash64(input_bytes , seed)}!")
92
+ print(f"Hash is {gxhash.gxhash64(file , seed)}!")
88
93
```
89
94
"""
90
95
91
- def gxhash64_nogil ( input_bytes : bytes , seed : int ) -> int :
96
+ def gxhash64_async ( file : BinaryIO , seed : int ) -> int :
92
97
"""
93
98
Summary
94
99
-------
@@ -97,28 +102,29 @@ def gxhash64_nogil(input_bytes: bytes, seed: int) -> int:
97
102
98
103
Parameters
99
104
----------
100
- input_bytes (bytes): input bytes to hash
105
+ file (BinaryIO)
106
+ file-like object
101
107
102
- seed (int): seed for the hash function
108
+ seed (int)
109
+ seed for the hash function
103
110
104
111
105
112
Returns
106
113
-------
107
- hash (int): u64 hash of the input bytes
114
+ hash (Awaitable[int])
115
+ u64 hash of the input bytes
108
116
109
117
110
118
Example
111
119
-------
112
120
```python
113
- import gxhash
114
-
115
- input_bytes = bytes([42] * 1000)
121
+ file = BytesIO(bytes([42] * 1000))
116
122
seed = 1234
117
- print(f"Hash is {gxhash.gxhash64_nogil(input_bytes , seed)}!")
123
+ print(f"Hash is {gxhash.gxhash64_async(file , seed)}!")
118
124
```
119
125
"""
120
126
121
- def gxhash128 (input_bytes : bytes , seed : int ) -> int :
127
+ def gxhash128 (file : BinaryIO , seed : int ) -> int :
122
128
"""
123
129
Summary
124
130
-------
@@ -127,28 +133,29 @@ def gxhash128(input_bytes: bytes, seed: int) -> int:
127
133
128
134
Parameters
129
135
----------
130
- input_bytes (bytes): input bytes to hash
136
+ file (BinaryIO)
137
+ file-like object
131
138
132
- seed (int): seed for the hash function
139
+ seed (int)
140
+ seed for the hash function
133
141
134
142
135
143
Returns
136
144
-------
137
- hash (int): u128 hash of the input bytes
145
+ hash (int)
146
+ u128 hash of the input bytes
138
147
139
148
140
149
Example
141
150
-------
142
151
```python
143
- import gxhash
144
-
145
- input_bytes = bytes([42] * 1000)
152
+ file = BytesIO(bytes([42] * 1000))
146
153
seed = 1234
147
- print(f"Hash is {gxhash.gxhash128(input_bytes , seed)}!")
154
+ print(f"Hash is {gxhash.gxhash128(file , seed)}!")
148
155
```
149
156
"""
150
157
151
- def gxhash128_nogil ( input_bytes : bytes , seed : int ) -> int :
158
+ def gxhash128_async ( file : BinaryIO , seed : int ) -> int :
152
159
"""
153
160
Summary
154
161
-------
@@ -157,23 +164,24 @@ def gxhash128_nogil(input_bytes: bytes, seed: int) -> int:
157
164
158
165
Parameters
159
166
----------
160
- input_bytes (bytes): input bytes to hash
167
+ file (BinaryIO)
168
+ file-like object
161
169
162
- seed (int): seed for the hash function
170
+ seed (int)
171
+ seed for the hash function
163
172
164
173
165
174
Returns
166
175
-------
167
- hash (int): u128 hash of the input bytes
176
+ hash (Awaitable[int])
177
+ u128 hash of the input bytes
168
178
169
179
170
180
Example
171
181
-------
172
182
```python
173
- import gxhash
174
-
175
- input_bytes = bytes([42] * 1000)
183
+ file = BytesIO(bytes([42] * 1000))
176
184
seed = 1234
177
- print(f"Hash is {gxhash.gxhash128_nogil(input_bytes , seed)}!")
185
+ print(f"Hash is {gxhash.gxhash128_async(file , seed)}!")
178
186
```
179
187
"""
0 commit comments