You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
blake2s-256 and blake2b-256 for the same input generate different hashcodes of the same size but have the same fncode 0xb2 and different digsize than their lengths which are both 0x20.
This may be ok for people who store a table of 2 byte codes that each map to a function name and output size, but it does not work for my usecase of only fncode and store size in my own data format which is more general than hashes. I therefore cant use fncode with the actual output size because its not unique and will have to make my own table of fncodes.
Do the hash functions have more parameters than I'm considering? Why is it done this way? Or is the csv file wrong?
The text was updated successfully, but these errors were encountered:
The hash function code is represented in binary as a varint -- compliant multihash implementations will correctly parse 0xb260 (and 0xb220) as the hash function code, not 0xb2. The length of the hash is a separate varint.
In your system, you'd need to use 2 bytes (or 4, or ideally a varint) for storing the hash function code.
https://github.com/multiformats/multihash/blob/master/hashtable.csv says:
blake2s-256 0xb260
blake2b-256 0xb220
blake2s-256 and blake2b-256 for the same input generate different hashcodes of the same size but have the same fncode 0xb2 and different digsize than their lengths which are both 0x20.
This may be ok for people who store a table of 2 byte codes that each map to a function name and output size, but it does not work for my usecase of only fncode and store size in my own data format which is more general than hashes. I therefore cant use fncode with the actual output size because its not unique and will have to make my own table of fncodes.
Do the hash functions have more parameters than I'm considering? Why is it done this way? Or is the csv file wrong?
The text was updated successfully, but these errors were encountered: