# Multihash decode

`multihash-decode` · version 1.0.0 · Hashing & signatures · free, no key needed

Strictly decode a canonical bounded hexadecimal multihash.

**Use when you need to: decode canonical multihash bytes · inspect multihash algorithm code · extract digest from multihash.**

## Decide before calling

Read the [versioned contract](/v1/tools/multihash-decode/versions/1.0.0) and the supported scope below. Reuse `multihash-decode@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `multihash-decode@1.0.0` for decode canonical multihash bytes. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- decode canonical multihash bytes
- inspect multihash algorithm code
- extract digest from multihash
- parse multihash hex envelope
- validate minimal multihash varints
- identify pinned multihash codec

## Not supported

- trusting or authenticating decoded data
- unknown or noncanonical multicodec values

## Behavior

- Rejects truncated, overlong, unknown, and size-inconsistent multihashes.
- Returns the pinned algorithm name and exact digest bytes.
- Disclaimer: decodes only; no signature, issuer, or expiry is verified, so do not trust the claims.

## Input

- `multihash` (string, required): max length 136; pattern `^(?:[0-9a-f]{2})*$`

## Output

- `algorithm` (string, required)
- `code` (integer, required): min 0
- `digest` (string, required)
- `digest_size` (integer, required): min 0; max 64
- `standard` (string, required)
- `reference` (string, required)
- `data_version` (string, required)

## Limits

- max multihash bytes: 68
- max digest bytes: 64

## Example

Request input:

```json
{
  "multihash": "12200000000000000000000000000000000000000000000000000000000000000000"
}
```

Response:

```json
{
  "result": {
    "algorithm": "sha2-256",
    "code": 18,
    "digest": "0000000000000000000000000000000000000000000000000000000000000000",
    "digest_size": 32,
    "standard": "Multiformats Multihash specification",
    "reference": "multihash = varint(code) || varint(size) || digest; unsigned LEB128 must be minimally encoded",
    "data_version": "multicodec-2026-10-24"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "multihash-decode",
  "version": "1.0.0",
  "input": {
    "multihash": "12200000000000000000000000000000000000000000000000000000000000000000"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/multihash-decode/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"multihash":"12200000000000000000000000000000000000000000000000000000000000000000"}'
```

The machine-readable contract is at [/v1/tools/multihash-decode/versions/1.0.0](/v1/tools/multihash-decode/versions/1.0.0).

### CLI

```sh
node cli.mjs run multihash-decode 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Multihash digest verify](/tools/multihash-digest-verify): Verify exact digest bytes and optional algorithm against a canonical multihash.
- [Multihash encode](/tools/multihash-encode): Encode a bounded digest as a canonical hexadecimal multihash.
- [Crc catalog compute](/tools/crc-catalog-compute): Compute a pinned RevEng CRC of hex bytes, including crossed-endian CRC-12/UMTS.
- [Crc catalog identify](/tools/crc-catalog-identify): Identify pinned CRC RevEng algorithms that match every explicit message and check sample.
- [Crc check value verify](/tools/crc-check-value-verify): Recompute a pinned catalogue CRC of ASCII 123456789 and compare an observed check.
- [Hash digest verify](/tools/hash-digest-verify): Recompute a fixed-length digest over encoded input bytes and compare it to an expected digest given in any encoding.
