multiformats / multicodec

Compact self-describing codecs. Save space by using predefined multicodec tables.
MIT License
334 stars 200 forks source link

add `iroh-hashseq` codec #347

Closed cameronfyfe closed 2 months ago

cameronfyfe commented 3 months ago

This adds a codec for hash sequence blobs used by Iroh.

Docs describing hash sequence blobs: https://iroh.computer/docs/layers/blobs#collections

vmx commented 3 months ago

To make sure I understand it correctly: This is a list of 32-byte long BLAKE3 hashes. One could say it's an IPLD Codec, as you could use it to build DAGs (you'd make CIDs with raw as Codec and blake3 as Multihash out of each hash).

What about giving it a more general name then, something like blake3-32-seq or so? Similar to what we've done at https://github.com/multiformats/multicodec/pull/343).

BTW: a maybe more permanent link to the spec is https://github.com/n0-computer/iroh.computer/blob/030f0b8104898327ca172ed5d1d84479d83208ad/src/app/docs/layers/blobs/page.mdx#collections

cameronfyfe commented 3 months ago

Thanks for the quick response.

Yes, my mental map of the codec was mapping to list<link> with pre-defined hash/codec as you described.

I can see the argument for making it more general. What about just blake3-hashseq? I could see any variation of {blake3|blake3-32|blake3-256}{hashseq|seq} making sense but that's my first choice.

vmx commented 3 months ago

blake3-hashseq sounds good to me. @rvagg what do you think?