lockblox / multihash

C++ Implementation of Multihash
MIT License
10 stars 2 forks source link

Varint codes #3

Closed Stebalien closed 5 years ago

Stebalien commented 5 years ago

https://github.com/cpp-ipfs/cpp-multihash/blob/875d95b2acbef72286910efd4f71c7ec1e3b8c6c/multihash/detail/HashRawCodecImpl.cpp#L8

Multihash uses base128 varints (variable length ints) for codes and lengths >= 128. While not all implementations need to support varints, an implementation that doesn't should check that the length/code is less than 128 and return a "not supported" error otherwise.

markovchainy commented 5 years ago

The implementation now throws when code or length is > 127

Stebalien commented 5 years ago

LGTM.