ivilata / pymultihash

Python implementation of the multihash specification
19 stars 8 forks source link

Use protobuf (sqlite, v8, etc.) varints #7

Open Stebalien opened 5 years ago

Stebalien commented 5 years ago

Multihash uses protobuf varints to encode both the multicodec and the hash length. This doesn't matter for codec < 0x80 and lengths < 128 bytes. However, this library should still either assert that (and refuse to operate over other codecs/lengths) or encode these numbers.

I can't vouch for this library but the varint implementation looks correct at first glance: https://github.com/fmoo/python-varint