Fix several issues with the hashing method#2110
Merged
Merged
Conversation
4e18f15 to
0ce037a
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
75a3407 to
b6d0d09
Compare
giovannipizzi
requested changes
Oct 25, 2018
Member
There was a problem hiding this comment.
Missing hash of the filename
Member
There was a problem hiding this comment.
One needs a end of sequence (same for sets, dicts)
Member
There was a problem hiding this comment.
Todo: Ensure this function consistently returns unicode
Member
There was a problem hiding this comment.
Suggestion: for make_hash, when an OrderedDict is passed, check for a kwarg (e.g. 'consider_as_unsorted' or a better name): if True, continue; if False, raise
Contributor
Author
|
@giovannipizzi do you want to talk another look at the changes dec77be ? |
giovannipizzi
previously approved these changes
Oct 25, 2018
* dict items are sorted _after_ hashing, fixing the behavior for keys which can not be sorted * unicode/str and str/bytes are explicitly handled, with a different type salt * in general, the combination between two hashes is done via the method of boost::hash_combine, not by concatenating the hexdigest
dec77be to
2b488c0
Compare
Contributor
Author
|
@giovannipizzi I rebased, can you do a squash&merge please? |
giovannipizzi
approved these changes
Oct 25, 2018
This was referenced Oct 25, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an an alternative to #2049 using Blake2b as the hash algorithm (in tree configuration).
Besides fixing the same issues, I discovered some other problems which slipped through the cracks:
inttype works differently between Python 2 and 3: while anp.int64was matched by it in Python 2, Python 3 was using the string type instead, which is why we are usingnumbers.Integralnow"..."will be a differerent hash type in Python 2 and 3struct.packwith the little-endian standard for getting the byte representation instead of the string representation. Arbitrary length of integers are therefore currently not supported I guess.I guess it may make sense to squash @greschd 's commits with my main commit. So, instead of reviewing the diff, it is probably better to review the final code.