Generates a fast checksum for the input data This function is not to be used for cryptography but rather for deduplication and similar use cases as the hashing is optimized for speed
(data: Union[bytes, str])
| 341 | |
| 342 | |
| 343 | def fast_checksum(data: Union[bytes, str]) -> str: |
| 344 | """ |
| 345 | Generates a fast checksum for the input data |
| 346 | This function is not to be used for cryptography but rather for deduplication and similar use cases as the hashing is optimized for speed |
| 347 | """ |
| 348 | if type(data) == str: |
| 349 | data = data.encode("utf-8") |
| 350 | |
| 351 | return hex(adler32(data))[2:] # Omit the `0x` at the start from `hex()` |
| 352 | |
| 353 | |
| 354 | class Analyzer: |
no outgoing calls
no test coverage detected