-
Notifications
You must be signed in to change notification settings - Fork 3
Things before upstreaming #5
Comments
As much as I love the What is left is then getting |
I think everything I wanted before upstreaming is now there. |
Can we add back the code enum? I'd like for the ipld block api to follow what the codec does and take the multihash code, where it's compatible with the store multihash. |
Upstreaming will take a while (I also want to take a closer look at the rust-ipld code and the tiny-cid code first), so there's still plenty of time for adding things.
Yes sure. The idea would be to just generate that from the multihash-derive, right? |
Exactly |
There are a few things I'd like to tackle before upstreaming. I put them into a single issue so that they can be discussed easily and we don't span this across zillions of issues or bloat PRs.
I split them into "ideas" which I think would make sense, but I'm, not sure about and "issues" which I think need to be fixed. Though they are all open for dicussions.
Ideas:
generic_array::typenum::
asmultihash::sizes::
or soCurrently we only re-export some sized
Issues:
size()
should return the actual size. For most of the digests it's the same as the digest size. But it's not the case for the Identity hash.digest()
should return the slice of the actual digest. This is again an issue for the Identity hash, where it should be trimmed tosize()
.TryFrom
traits (and potentially remove the other functions from the traits (that's open for discussion):from_bytes()
/to_bytes()
in the MultihashDigestfrom_mh()
/to_mh()
inRawMultihash
I've crated a list of things a Multihash implementation should implement and I think all those will be addressed. If I miss anything that should be supported (and perhaps already is by this library), please let me know:
An instance of a Multihash can be created in several ways:
code
,size
anddigest
.The Multihash instance then provides access to the properties of a hash:
code
: The code of the Multihash.size
: Thesize
needs to be the actual size. It may differ from the default hash size due to two reasons. Multihash supports trunctated hashes and there is also hash functions with arbitrary sizes, like Blake3.digest
: The actual hash.The text was updated successfully, but these errors were encountered: