Hash Lab

Application

IPFS Content IDs

IPFS names every piece of content by a Content ID (CID) derived from its hash. The multihash format wraps the digest with its algorithm code and length, so the IPFS network is hash-agnostic (SHA-256 today, BLAKE3 tomorrow).

12 bytes. We treat the input as raw bytes ("raw" codec 0x55 in CIDv1).

How a CID is built

  1. Hash the content with SHA-256 (or any other supported hash).
  2. Build the multihash: 0x12 (hash fn code) ‖ 0x20 (digest length) ‖ digest.
  3. CIDv0: base58btc-encode the multihash. Always 46 chars starting with Qm.
  4. CIDv1: 0x01 (version) ‖ codec ‖ multihash, then multibase-encode (typically base32 lowercase, prefix b). Starts with bafk for the raw codec.