go-multihash
go-multihash copied to clipboard
initial pass converting to string-based multihashes
TODO:
- [ ] Consider Nil versus Zero.
- [ ] Performance (especially better decoding).
- [ ] Some nice decode method for extracting information from a validated multihash. Need to discuss how this would look.
Updates to reverse-dependencies:
- libp2p/go-libp2p-kad-dht
- libp2p/go-libp2p-peer
- libp2p/go-libp2p-record
- libp2p/go-libp2p-secio
- libp2p/go-testutil
- multiformats/go-multiaddr
- ipfs/go-cid
- ipfs/go-cidutil
- ipfs/go-ipfs-blockstore
- ipfs/go-ipld-git
Note: there are a bunch of FIXME(steb) comments in these related to the third
todo. Currently, I'm just using mh.Decode(hash.Bytes()) but that kind of sucks.
Ignore the broken CI. That's happening because we can't build GX with this version of go-multihash because it breaks go-multiaddr.
Okay. When I initially did the conversion I tried to do a more complete conversion. If we are okay with leaving DecodedMultihash alone and leaving the functions that work on raw bytes alone I am okay with this. I would suggest we add a SumToBytes() function as that adds no overhead and if there are any external uses that depend on a Multihash being a byte they can likely get by using the combination of the Decode() Encode() and SumToBytes() functions.
I created a second p.r. that continues this one: #84.
Performance (especially better decoding).
My FromBinary() takes care of this in #84. I am okay with adding a few more checks but I want this to be fast as so that cid.Hash() is also fast as we can no longer directly cast to a Multihash type.
Some nice decode method for extracting information from a validated multihash.
I think we should keep this simple and just have a Parts() method as I did in #82 and carried over in #84.