dwyl / dwyl/cid

How to detect multibase of a CID

Open
#15 1 comment 0 reactions 1 assignee Claimed by @SimonLab View on GitHub
Dominant language
Elixir
Stars
38
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Given a CID the first step when decoding the CID is to determine which multibase is used
see https://github.com/multiformats/multibase

The CID(v1) encode this information on the first byte (ie the first 8 bits), see https://github.com/multiformats/cid#decoding-algorithm where:

![image](https://user-images.githubusercontent.com/6057298/51490285-b9c34380-1da2-11e9-9af5-9ec140b871b8.png)

- So the first step is to extract the first byte and to get a representation in hexadecimal. Then we can match with the multibase table to determine which encoding is used (the 0x is an indication to tell us that the text is in base16 which is hexadecimal)

![image](https://user-images.githubusercontent.com/6057298/51490141-37d31a80-1da2-11e9-9bf1-bf1469746e00.png)

- [ ] Check the implementations of multibase to know how the first byte is extracted
see https://github.com/multiformats/js-multibase

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.