try 2: allow hash()
to take multiple arguments similar to pack()
#1719
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 another attempt to allow passing
hash()
multiple arguments to concatenate together similar to howpack()
already does. This can allow some more concise usage ofhash()
without resorting tomake_tuple/pair()
and remembering to avoid the trap of needing to usecref
along withmake_tuple/pair()
to avoid copies.Based on this comment chain #1526 (comment) I have modified the hash impls such that,
hash_raw()
takes aContiguousCharSource
that it hashes directly -- this is the previous behavior when using these nontemplated call forms:spring/libraries/libfc/include/fc/crypto/sha1.hpp
Lines 20 to 21 in e3caa44
hash()
now is variadic and hashes with the same rules of our serialization formatOf course this means that usage of
hash(std::string())
now has different output between these two revisions so any usages of that which matter (many don't!) need to be migrated tohash_raw(std::string())
.So the way I approached this was to first convert all calls to the two forms above to
hash_raw()
, and then go back and make a determination for sites that are fine to transition to simplehash()
in order to limit the number ofhash_raw()
calls. But that was a huge pain: so this PR just leaves all calls to the two forms above ashash_raw()
but that means the change set is large.Ultimately I'm not really all that confident in making such a huge change.