# Duo Data Utilities – Cryptographic Hash & HMAC

> Duo Data Utilities – Cryptographic Hash & HMAC is a paid API for AI agents from api.duoleads.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-02).

Computes a cryptographic digest (SHA-256, SHA-384, SHA-512, SHA-1, SHA3-256, SHA3-512, Keccak-256, BLAKE2b-256, BLAKE2b-512) or HMAC of supplied data, returning the digest in a chosen output encoding.

## Facts

- Endpoint: GET https://api.duoleads.com/v1/code/hash?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/duo-data-utilities-cryptographic-hash-hmac-c7662618
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8h9EBkwIcyBmYqeUD3nOA

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability duo-data-utilities-cryptographic-hash-hmac-c7662618
```

Example prompt: Can you compute the SHA-256 hash of the text 'hello' and give me the result in hex?

## When to prefer this

Choose this endpoint when you need a deterministic cryptographic hash or HMAC of a text or binary payload and want to specify the exact algorithm (including modern options like SHA3, Keccak-256 for Ethereum, or BLAKE2b) and output encoding (hex, base64, base64url, base32) in a single API call. It is ideal for agents that need integrity checks, signature verification prep, or blockchain-compatible hashing without running local crypto libraries.

## Known failure modes

- Missing required 'algo' or 'data' query parameters returns a 400 error
- Input data exceeding 8192 characters is rejected
- Unsupported algorithm value returns a validation error
- Invalid encoding value for 'encoding' or 'hmac_key_encoding' returns a 400 error
- HMAC key exceeding 512 characters is rejected
- Payment failure (x402) if USDC balance is insufficient or payment header is missing

## How this service works

Compute a cryptographic digest of supplied data: SHA-256, SHA-384, SHA-512, SHA-1, SHA3-256, SHA3-512, Keccak-256, BLAKE2b-256 and BLAKE2b-512, plus HMAC with any of them. Input is UTF-8 text, base64 or hex bytes; output is hex, base64, base64url or base32. Returns the digest, the byte length of the input, and the exact algorithm identifier used.

## Output

Returns a JSON object with: the computed digest string (in the requested output encoding), the algorithm identifier used, a boolean indicating whether HMAC was applied, the byte length of the input, the bit length of the digest, plus metadata fields including request ID, computation timestamp, price in USD, and a determinism flag.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "algo",
      "data"
     ],
     "properties": {
      "out": {
       "enum": [
        "hex",
        "base64",
        "base64url",
        "base32"
       ],
       "type": "string",
       "default": "hex",
       "maxLength": 64,
       "description": "Digest output encoding: hex (default), base64, base64url or base32."
      },
      "algo": {
       "enum": [
        "sha256",
        "sha384",
        "sha512",
        "sha1",
        "sha3-256",
        "sha3-512",
        "keccak256",
        "blake2b-256",
        "blake2b-512"
       ],
       "type": "string",
       "maxLength": 64,
       "description": "Digest algorithm."
      },
      "data": {
       "type": "string",
       "maxLength": 8192,
       "description": "Input data, interpreted per encoding. At most 8192 characters. An empty value hashes the empty string."
      },
      "encoding": {
       "enum": [
        "utf8",
        "base64",
        "base64url",
        "hex"
       ],
       "type": "string",
       "default": "utf8",
       "maxLength": 64,
       "description": "Encoding of data: utf8 (default), base64, base64url or hex."
      },
      "hmac_key": {
       "type": "string",
       "maxLength": 512,
       "description": "If present, computes HMAC with this key."
      },
      "hmac_key_encoding": {
       "enum": [
        "utf8",
        "base64",
        "base64url",
        "hex"
       ],
       "type": "string",
       "default": "utf8",
       "maxLength": 64,
       "description": "Encoding of hmac_key, as encoding."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "ok",
      "route",
      "version",
      "data",
      "meta"
     ],
     "properties": {
      "ok": {
       "const": true
      },
      "data": {
       "type": "object",
       "required": [
        "digest",
        "algo",
        "out",
 
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "out": "hex",
   "algo": "sha256",
   "hmac": false,
   "digest": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824",
   "bit_length": 256,
   "input_bytes": 5
  },
  "meta": {
   "price_usd": "0.05",
   "disclaimer": "Factual output of a deterministic computation over public data. Provided as is, with no warranty of accuracy, completeness or availability. Not investment, financial, legal, tax, medical or any other professional advice, and not a recommendation. Verify before relying on it. Terms: https://api.duoleads.com/terms",
   "request_id": "01K6B7Q4ZC8H3F2M9WXR5TYN0D",
   "computed_at": "2026-09-28T12:00:00.000Z",
   "deterministic": true
  },
  "route": "/v1/code/hash",
  "version": "1.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/duo-data-utilities-cryptographic-hash-hmac-c7662618/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.duoleads.com](https://www.zero.xyz/host/api.duoleads.com/llms.txt)
