hashing doesn't correctly handle some corner cases
See original GitHub issueIssue
Description In experimenting with my “educational” version of ElectionGuard, where I accumulated the whole formula of every operation on ElementModP and Q, I discovered a few misfeatures in the hash function.
- If the value being hashed is the integer 0, that’s treated by Python as “false” and is hashed as “null”
- There were some cases where lists weren’t being hashed recursively, but were instead being converted to a string and then hashed as a string
None of these impact correctness, since the hash still properly depends on the value in question, but they do impact portability, in the sense that another programming language might properly implement the same hash function with identical behavior.
The patch is pretty simple, only a few changes in hash.py
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Practice Problems on Hashing
In this article, we will discuss the types of questions based on hashing. Before understanding this, you should have idea about hashing, ...
Read more >How to handle duplicate hashes
How to handle duplicate hashes ... AFAIK git just trusts sha1 hash to be unique, so it doesn't handle cases when two hashes...
Read more >Hash Collision - an overview
They target some corner-case, worst-case, or pathological behavior of a function. Another example, albeit a narrowly-focused one, is the hash collision ...
Read more >Which hashing algorithm is best for uniqueness and speed?
I tested some different algorithms, measuring speed and number of ... This points out that CityHash has some problems in corner cases.
Read more >Address certain corner cases of time-travel queries by ...
With the exception of what I described above, that's what happens, and using a hash that is not the hash of a valid...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for this thread and discussion. We hope to address this immediately after our next release. We plan to enable a suite of more efificient unit tests with prescriptive values such as you indicate.
We are pulling this in to the current iteration.