Multihash is a self-describing hash format developed by Protocol Labs in which the hash digest is prefixed with a varint-encoded function code and digest length, enabling consumers to identify the hash algorithm without out-of-band knowledge. It is a foundational component of the IPFS content-addressing stack and the Multiformat suite, providing algorithm agility so that systems can upgrade from SHA-256 to SHA3 or BLAKE3 without breaking existing identifiers. Any hash function can be registered in the Multihash table and the format is codec-neutral.
Content
- Multihash was designed by Juan Benet and the Protocol Labs team circa 2015 as part of the broader Multiformats initiative. The motivation was a concrete engineering problem: IPFS needed a content-addressing scheme that could outlive any single hash algorithm. Prior systems hard-coded SHA-256 into their identifier format, meaning a collision vulnerability or algorithm deprecation would require a breaking protocol change. By prepending a two-varint header (function code, digest length), Multihash decouples algorithm choice from identifier structure.
- A Multihash value is constructed by taking a raw hash digest and prepending the varint-encoded function code from the Multihash table (e.g., 0x12 for SHA2-256, 0x1b for KECCAK-256, 0x1e for BLAKE3) followed by the varint-encoded byte length of the digest. The result is a self-contained binary blob that any compliant parser can decompose without a lookup table or configuration file. Multihash values are typically further encoded in Base58btc or Base32 to produce human-readable CIDs.
- In the IPFS and libp2p ecosystems, Multihash is ubiquitous: every CIDv0 and CIDv1 contains a Multihash, peer IDs are derived from Multihashes of public keys, and Merkle DAG node links reference Multihash-based CIDs. The format has been adopted in IPLD (InterPlanetary Linked Data), Filecoin, and various blockchain projects that need content-addressed data. Its algorithm agility is especially relevant as the industry begins planning post-quantum transitions.
- As of 2024-2025, the Multihash table registers over 100 functions and the format is stable at version 1. Work on CIDv2 proposes richer metadata in the identifier but retains the Multihash inner structure. The broader Multiformats project continues to expand, with Multicodec and Multiaddr following the same self-describing philosophy. Multihash’s influence extends beyond IPFS: it informs content-addressing proposals in the W3C Verifiable Credentials ecosystem and in decentralised social protocols.