# Crypto Math Encoding Converter

> Crypto Math Encoding Converter is a paid API for AI agents from crypto-math.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Convert public byte strings between hex, base64, and base64url (RFC 4648) with strict decoding and optional expected-length verification.

## Facts

- Endpoint: GET https://crypto-math.x402tookit.com/encoding?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/crypto-math-encoding-converter-4be81785
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_V3Zfp6pmzqJgoYfIkZIIN

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 crypto-math-encoding-converter-4be81785
```

Example prompt: Convert this SHA-256 hex digest to base64url and confirm it's exactly 32 bytes: a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e

## When to prefer this

Choose this endpoint when you need strict RFC 4648 compliant encoding conversion between hex, base64, and base64url for public cryptographic values (hashes, public keys, nonces), especially when you also need to verify the decoded byte length matches an expected value like 32 bytes for SHA-256 or 65 bytes for an uncompressed EC point. Prefer it over general-purpose base64 libraries when canonical-form checking and multi-format output in a single call are required.

## Known failure modes

- Non-canonical base64/base64url padding causes strict-decode rejection
- Input length does not match expectBytes, returning lengthMatches: false
- Unknown or missing 'from' format parameter causes a validation error
- Malformed hex string (odd length, non-hex characters) fails decoding
- Empty input string returns an error or empty result

## How this service works

Convert public bytes between hex, base64 and base64url (RFC 4648) with strict decoding and expected-length check.

## Output

Returns an object containing the input value re-encoded as hex, base64, and base64url simultaneously, along with the raw byte array, byte length, bit length, a canonical flag indicating whether the input was in canonical form, and a lengthMatches boolean if an expected byte length was provided. Also includes a summary and any validation reasons or warnings.

## 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": [
      "input",
      "from"
     ],
     "properties": {
      "from": {
       "type": "string",
       "description": "Input format: hex, base64, base64url or utf8"
      },
      "input": {
       "type": "string",
       "description": "The value to convert (a hash, public key, nonce or text; never a secret)"
      },
      "expectBytes": {
       "type": "integer",
       "description": "Expected byte length to verify, e.g. 32 for a SHA-256 digest"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "hex": {
       "type": [
        "null",
        "string"
       ]
      },
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "bytes": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "number"
       }
      },
      "base64": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "base64url": {
       "type": [
        "null",
        "string"
       ]
      },
      "bitLength": {
       "type": [
        "null",
        "number"
       ]
      },
      "canonical": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "byteLength": {
       "type": [
        "null",
        "number"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
 
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/crypto-math-encoding-converter-4be81785/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from crypto-math.x402tookit.com](https://www.zero.xyz/host/crypto-math.x402tookit.com/llms.txt)
