Skip to content

How to detect multibase of a CID #15

@SimonLab

Description

@SimonLab

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

  • 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions