|
1 |
| -def gxhash32(input: bytes, seed: int) -> int: ... |
2 |
| -def gxhash64(input: bytes, seed: int) -> int: ... |
3 |
| -def gxhash128(input: bytes, seed: int) -> int: ... |
| 1 | +def gxhash32(input_bytes: bytes, seed: int) -> int: |
| 2 | + """ |
| 3 | + Summary |
| 4 | + ------- |
| 5 | + hashes an arbitrary stream of bytes to an u32 |
| 6 | +
|
| 7 | +
|
| 8 | + Parameters |
| 9 | + ---------- |
| 10 | + input_bytes (bytes): input bytes to hash |
| 11 | +
|
| 12 | + seed (int): seed for the hash function |
| 13 | +
|
| 14 | +
|
| 15 | + Returns |
| 16 | + ------- |
| 17 | + hash (int): u32 hash of the input bytes |
| 18 | +
|
| 19 | +
|
| 20 | + Example |
| 21 | + ------- |
| 22 | + ```python |
| 23 | + import gxhash |
| 24 | +
|
| 25 | + input_bytes = bytes([42] * 1000) |
| 26 | + seed = 1234 |
| 27 | + print(f"Hash is {gxhash.gxhash32(input_bytes, seed)}!") |
| 28 | + ``` |
| 29 | + """ |
| 30 | + |
| 31 | + |
| 32 | +def gxhash32_nogil(input_bytes: bytes, seed: int) -> int: |
| 33 | + """ |
| 34 | + Summary |
| 35 | + ------- |
| 36 | + hashes an arbitrary stream of bytes to an u32 without the GIL |
| 37 | +
|
| 38 | +
|
| 39 | + Parameters |
| 40 | + ---------- |
| 41 | + input_bytes (bytes): input bytes to hash |
| 42 | +
|
| 43 | + seed (int): seed for the hash function |
| 44 | +
|
| 45 | +
|
| 46 | + Returns |
| 47 | + ------- |
| 48 | + hash (int): u32 hash of the input bytes |
| 49 | +
|
| 50 | +
|
| 51 | + Example |
| 52 | + ------- |
| 53 | + ```python |
| 54 | + import gxhash |
| 55 | +
|
| 56 | + input_bytes = bytes([42] * 1000) |
| 57 | + seed = 1234 |
| 58 | + print(f"Hash is {gxhash.gxhash32_nogil(input_bytes, seed)}!") |
| 59 | + ``` |
| 60 | + """ |
| 61 | + |
| 62 | + |
| 63 | +async def gxhash32_async(input_bytes: bytes, seed: int) -> int: |
| 64 | + """ |
| 65 | + Summary |
| 66 | + ------- |
| 67 | + hashes an arbitrary stream of bytes to an u32 asynchronously in a Rust thread |
| 68 | +
|
| 69 | +
|
| 70 | + Parameters |
| 71 | + ---------- |
| 72 | + input_bytes (bytes): input bytes to hash |
| 73 | +
|
| 74 | + seed (int): seed for the hash function |
| 75 | +
|
| 76 | +
|
| 77 | + Returns |
| 78 | + ------- |
| 79 | + hash (int): u32 hash of the input bytes |
| 80 | +
|
| 81 | +
|
| 82 | + Example |
| 83 | + ------- |
| 84 | + ```python |
| 85 | + import gxhash |
| 86 | + import asyncio |
| 87 | +
|
| 88 | + async def main(): |
| 89 | + input_bytes = bytes([42] * 1000) |
| 90 | + seed = 1234 |
| 91 | + print(f"Hash is {await gxhash.gxhash32_async(input_bytes, seed)}!") |
| 92 | +
|
| 93 | + asyncio.run(main()) |
| 94 | + ``` |
| 95 | + """ |
| 96 | + |
| 97 | + |
| 98 | +def gxhash64(input_bytes: bytes, seed: int) -> int: |
| 99 | + """ |
| 100 | + Summary |
| 101 | + ------- |
| 102 | + hashes an arbitrary stream of bytes to an u64 |
| 103 | +
|
| 104 | +
|
| 105 | + Parameters |
| 106 | + ---------- |
| 107 | + input_bytes (bytes): input bytes to hash |
| 108 | +
|
| 109 | + seed (int): seed for the hash function |
| 110 | +
|
| 111 | +
|
| 112 | + Returns |
| 113 | + ------- |
| 114 | + hash (int): u64 hash of the input bytes |
| 115 | +
|
| 116 | +
|
| 117 | + Example |
| 118 | + ------- |
| 119 | + ```python |
| 120 | + import gxhash |
| 121 | +
|
| 122 | + input_bytes = bytes([42] * 1000) |
| 123 | + seed = 1234 |
| 124 | + print(f"Hash is {gxhash.gxhash64(input_bytes, seed)}!") |
| 125 | + ``` |
| 126 | + """ |
| 127 | + |
| 128 | + |
| 129 | +def gxhash64_nogil(input_bytes: bytes, seed: int) -> int: |
| 130 | + """ |
| 131 | + Summary |
| 132 | + ------- |
| 133 | + hashes an arbitrary stream of bytes to an u64 without the GIL |
| 134 | +
|
| 135 | +
|
| 136 | + Parameters |
| 137 | + ---------- |
| 138 | + input_bytes (bytes): input bytes to hash |
| 139 | +
|
| 140 | + seed (int): seed for the hash function |
| 141 | +
|
| 142 | +
|
| 143 | + Returns |
| 144 | + ------- |
| 145 | + hash (int): u64 hash of the input bytes |
| 146 | +
|
| 147 | +
|
| 148 | + Example |
| 149 | + ------- |
| 150 | + ```python |
| 151 | + import gxhash |
| 152 | +
|
| 153 | + input_bytes = bytes([42] * 1000) |
| 154 | + seed = 1234 |
| 155 | + print(f"Hash is {gxhash.gxhash64_nogil(input_bytes, seed)}!") |
| 156 | + ``` |
| 157 | + """ |
| 158 | + |
| 159 | + |
| 160 | +async def gxhash64_async(input_bytes: bytes, seed: int) -> int: |
| 161 | + """ |
| 162 | + Summary |
| 163 | + ------- |
| 164 | + hashes an arbitrary stream of bytes to an u64 asynchronously in a Rust thread |
| 165 | +
|
| 166 | +
|
| 167 | + Parameters |
| 168 | + ---------- |
| 169 | + input_bytes (bytes): input bytes to hash |
| 170 | +
|
| 171 | + seed (int): seed for the hash function |
| 172 | +
|
| 173 | +
|
| 174 | + Returns |
| 175 | + ------- |
| 176 | + hash (int): u64 hash of the input bytes |
| 177 | +
|
| 178 | +
|
| 179 | + Example |
| 180 | + ------- |
| 181 | + ```python |
| 182 | + import gxhash |
| 183 | + import asyncio |
| 184 | +
|
| 185 | + async def main(): |
| 186 | + input_bytes = bytes([42] * 1000) |
| 187 | + seed = 1234 |
| 188 | + print(f"Hash is {await gxhash.gxhash64_async(input_bytes, seed)}!") |
| 189 | +
|
| 190 | + asyncio.run(main()) |
| 191 | + ``` |
| 192 | + """ |
| 193 | + |
| 194 | + |
| 195 | +def gxhash128(input_bytes: bytes, seed: int) -> int: |
| 196 | + """ |
| 197 | + Summary |
| 198 | + ------- |
| 199 | + hashes an arbitrary stream of bytes to an u128 |
| 200 | +
|
| 201 | +
|
| 202 | + Parameters |
| 203 | + ---------- |
| 204 | + input_bytes (bytes): input bytes to hash |
| 205 | +
|
| 206 | + seed (int): seed for the hash function |
| 207 | +
|
| 208 | +
|
| 209 | + Returns |
| 210 | + ------- |
| 211 | + hash (int): u128 hash of the input bytes |
| 212 | +
|
| 213 | +
|
| 214 | + Example |
| 215 | + ------- |
| 216 | + ```python |
| 217 | + import gxhash |
| 218 | +
|
| 219 | + input_bytes = bytes([42] * 1000) |
| 220 | + seed = 1234 |
| 221 | + print(f"Hash is {gxhash.gxhash128(input_bytes, seed)}!") |
| 222 | + ``` |
| 223 | + """ |
| 224 | + |
| 225 | + |
| 226 | +def gxhash128_nogil(input_bytes: bytes, seed: int) -> int: |
| 227 | + """ |
| 228 | + Summary |
| 229 | + ------- |
| 230 | + hashes an arbitrary stream of bytes to an u128 without the GIL |
| 231 | +
|
| 232 | +
|
| 233 | + Parameters |
| 234 | + ---------- |
| 235 | + input_bytes (bytes): input bytes to hash |
| 236 | +
|
| 237 | + seed (int): seed for the hash function |
| 238 | +
|
| 239 | +
|
| 240 | + Returns |
| 241 | + ------- |
| 242 | + hash (int): u128 hash of the input bytes |
| 243 | +
|
| 244 | +
|
| 245 | + Example |
| 246 | + ------- |
| 247 | + ```python |
| 248 | + import gxhash |
| 249 | +
|
| 250 | + input_bytes = bytes([42] * 1000) |
| 251 | + seed = 1234 |
| 252 | + print(f"Hash is {gxhash.gxhash128_nogil(input_bytes, seed)}!") |
| 253 | + ``` |
| 254 | + """ |
| 255 | + |
| 256 | + |
| 257 | +async def gxhash128_async(input_bytes: bytes, seed: int) -> int: |
| 258 | + """ |
| 259 | + Summary |
| 260 | + ------- |
| 261 | + hashes an arbitrary stream of bytes to an u128 asynchronously in a Rust thread |
| 262 | +
|
| 263 | +
|
| 264 | + Parameters |
| 265 | + ---------- |
| 266 | + input_bytes (bytes): input bytes to hash |
| 267 | +
|
| 268 | + seed (int): seed for the hash function |
| 269 | +
|
| 270 | +
|
| 271 | + Returns |
| 272 | + ------- |
| 273 | + hash (int): u128 hash of the input bytes |
| 274 | +
|
| 275 | +
|
| 276 | + Example |
| 277 | + ------- |
| 278 | + ```python |
| 279 | + import gxhash |
| 280 | + import asyncio |
| 281 | +
|
| 282 | + async def main(): |
| 283 | + input_bytes = bytes([42] * 1000) |
| 284 | + seed = 1234 |
| 285 | + print(f"Hash is {await gxhash.gxhash128_async(input_bytes, seed)}!") |
| 286 | +
|
| 287 | + asyncio.run(main()) |
| 288 | + ``` |
| 289 | + """ |
0 commit comments