[issue42942] Feature request: Add decdigest() to hashlib

2021-01-17 Thread Arnim Rupp
Arnim Rupp added the comment: oh, you're absolutely right about digest(), sorry, mixed the representation with the data. closing this, thanks. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-17 Thread Gregory P. Smith
Gregory P. Smith added the comment: Agreed, using a dict or set hash table lookup is more appropriate for such an algorithm. Also agreed: comparing python integers (30-bit digit bignums internally) cannot be faster than comparing a binary bytes object. -- __

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-17 Thread Christian Heimes
Christian Heimes added the comment: Is there any particular reason you are using bisect search with sorted list of integers? Why don't you use a simple approach with a dict of digest bytes? bisect search is O(log(n)), dict lookup is O(1) and therefore scales much better. -- ___

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-17 Thread Christian Heimes
Christian Heimes added the comment: Do you have any benchmarks that back up your claim that integers are faster than using digest or hexdigests? Python's str and bytes types are highly optimized. Hash digests don't fit into native integers, because they are larger than uint64_t and therefor

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-16 Thread Arnim Rupp
New submission from Arnim Rupp : Problem: hashlib only offers digest() and hexdigest() but the fastest way to work with hashes is as integer. The first thing loki does after getting the hashes is to convert them to int: md5, sha1, sha256 = generateHashes(fileData) md5_n