multiformats / multihash

Self describing hashes - for future proofing
https://multiformats.io/multihash/
MIT License
883 stars 112 forks source link

please help me-silly or is there a typo? #52

Open yarikoptic opened 7 years ago

yarikoptic commented 7 years ago

New to multihash (sounds sound ;) ) so pardon my ignorance and possibly RTFM question. https://github.com/multiformats/multihash/blob/master/README.md#idea-self-describe-the-values-to-distinguish has an example for sha3 256 which starts with 1420caad, but according to the multihash table (https://github.com/multiformats/multihash/blob/master/README.md#table-for-multihash-v100-rc-semver) 0x16 sha3-256. So why example doesn't start with 16? (I guessed that those examples are autogenerated so there must be no mistakes/bug, thus I guess it is all my misunderstanding)

satra commented 7 years ago

sha3 used to be 14 but has been deprecated, so i believe the readme is out of date in those pictures.

also in that picture sha2-512 should have length: 0x40 not 0x20

but only the captain @jbenet can clarify ;)

Nemo157 commented 7 years ago

The 0x20 byte sha2-512 multihash is a valid multihash. It means the resulting 512-bit hash has been truncated to 256-bits and only those first 256-bits of the hash should be checked when validating the hash (see https://github.com/multiformats/multihash/issues/1#issuecomment-91783612).

Although, that reference is still just a comment in an issue, it really should be added to the actual spec if it is going to be the standard.

RichardLitt commented 7 years ago

@Nemo157 Want to make a PR? :)