multihash icon indicating copy to clipboard operation
multihash copied to clipboard

please help me-silly or is there a typo?

Open yarikoptic opened this issue 8 years ago • 3 comments

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)

yarikoptic avatar Oct 06 '16 00:10 yarikoptic

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 ;)

satra avatar Oct 06 '16 01:10 satra

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.

Nemo157 avatar Nov 03 '16 19:11 Nemo157

@Nemo157 Want to make a PR? :)

RichardLitt avatar Nov 10 '16 13:11 RichardLitt