# Security Math Encoded Length Calculator

> Security Math Encoded Length Calculator is a paid API for AI agents from security-math.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-21).

Calculates the encoded character length of N bytes in hex, base64, base32, base58, base85, decimal, binary, octal, and optional custom base-N, plus bytes-per-100-characters ratios.

## Facts

- Endpoint: GET https://security-math.x402tookit.com/encoded-length?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/security-math-encoded-length-calculator-a86dfe42
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_l7H1fZBd1QyV5jhi6nl8g

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 security-math-encoded-length-calculator-a86dfe42
```

Example prompt: How many characters will a 32-byte SHA-256 digest produce when encoded in hex, base64, base58, and base85? Also show the encoding overhead percentages.

## When to prefer this

Choose this endpoint when you need to precisely calculate how many characters a given number of bytes will occupy across multiple standard encoding schemes (hex, base64, base58, base85, base32, etc.) or a custom base-N alphabet, especially when comparing encoding overhead or planning storage/field sizes in security-sensitive contexts.

## Known failure modes

- Missing required 'bytes' query parameter returns an error
- bytes value out of range (negative or above 1e12) returns a validation error
- alphabetSize outside 2–256 returns a validation error
- Non-numeric bytes value causes a schema validation failure
- Payment not included or insufficient results in HTTP 402

## How this service works

Encoded length of N bytes in hex, base64, base32, base58, base85, decimal or any base-N alphabet, and bytes per N characters.

## Output

Returns a JSON object with the number of characters produced by encoding the given byte count in hex, binary, octal, decimal, base32 (padded and unpadded), base64 (padded and unpadded), base85, and base58, plus bytes-per-100-characters ratios for major encodings, overhead percentages relative to hex and base64, and optionally a custom base-N length if alphabetSize was provided.

## 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": [
      "bytes"
     ],
     "properties": {
      "bytes": {
       "type": "number",
       "description": "Number of bytes to encode, 0 to 1e12 (a UUID is 16, a SHA-256 digest is 32)"
      },
      "alphabetSize": {
       "type": "integer",
       "description": "Optional custom alphabet size N (2 to 256): adds the length in base-N"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "bits": {
       "type": [
        "null",
        "number"
       ]
      },
      "bytes": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "characters": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "hex": {
         "type": [
          "null",
          "number"
         ]
        },
        "octal": {
         "type": [
          "null",
          "number"
         ]
        },
        "binary": {
         "type": [
          "null",
          "number"
         ]
        },
        "decimal": {
         "type": [
          "null",
          "number"
         ]
        },
        "base32Padded": {
         "type": [
          "null",
          "number"
         ]
        },
        "base64Padded": {
         "type": [
          "null",
          "number"
         ]
        },
        "base85Ascii85": {
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/security-math-encoded-length-calculator-a86dfe42/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from security-math.x402tookit.com](https://www.zero.xyz/host/security-math.x402tookit.com/llms.txt)
