Skip to main content

Module cid

Module cid 

Source
Expand description

CIDv1 (Content IDentifier) for DAG-CBOR blocks.

A CID is a self-describing content address. This crate uses CIDv1 with the dag-cbor codec (0x71) and sha2-256 multihash (0x12) — the atproto / IPLD default for repo blocks (commits, MST nodes, records).

§Wire format (CIDv1)

<version:u8=0x01><codec:varint><multihash>

where <multihash> = <hash-code:varint><digest-len:varint><digest-bytes>.

Inside DAG-CBOR, a CID is carried as a byte string tagged with CBOR tag 42, whose payload is a “CID specifier”: a leading 0x00 (identity-multibase marker, per the DAG-CBOR spec) followed by the raw CID bytes (version+codec+multihash). The 0x00 prefix exists so a CID can never collide with a legitimate CBOR byte string.

Structs§

Cid
A CIDv1 content identifier.

Constants§

CODEC_DAG_CBOR
Codec code for dag-cbor (0x71) — used for atproto repo blocks.
CODEC_RAW
Codec code for raw (0x55) — opaque byte blocks.