# Crypto Math: Modular Exponentiation (mod-pow)

> Crypto Math: Modular Exponentiation (mod-pow) 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).

Computes base^exp mod m for big integers (up to 4096 bits), accepting decimal or 0x hex inputs, returning both decimal and hex results.

## Facts

- Endpoint: GET https://crypto-math.x402tookit.com/mod-pow?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-modular-exponentiation-mod-pow-bd28b208
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_s1QJmx6BOBvZ2uxQ9dy46

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-modular-exponentiation-mod-pow-bd28b208
```

Example prompt: Can you compute 0x3A7F ^ 65537 mod 0xFFFFFFFFFFFFFFC5 and give me the result in both decimal and hex?

## When to prefer this

Use this endpoint when you need to perform modular exponentiation on large integers (up to 4096 bits) typical in cryptographic operations like RSA, Diffie-Hellman, or ElGamal. It is ideal when inputs may be in either decimal or hex format and you need results in both representations. Prefer this over general-purpose math APIs when working specifically with big-integer cryptographic arithmetic.

## Known failure modes

- Missing required query parameters (base, exp, or mod) returns an error
- Modulus of zero or negative value causes an invalid input error
- Exponent that is negative returns an error
- Input exceeding 4096-bit limit may be rejected
- Malformed hex strings (bad 0x prefix or non-hex characters) cause parse errors

## How this service works

Modular exponentiation base^exp mod m for big integers, decimal or 0x hex, up to 4096 bits.

## Output

Returns the computed value of base^exp mod m as both a decimal string and a hex string, along with the bit lengths of the modulus and exponent, and metadata like source and summary.

## 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": [
      "base",
      "exp",
      "mod"
     ],
     "properties": {
      "exp": {
       "type": "string",
       "description": "Exponent, non-negative whole number"
      },
      "mod": {
       "type": "string",
       "description": "Modulus, whole number of at least 1"
      },
      "base": {
       "type": "string",
       "description": "Base, whole number (decimal or 0x hex, may be negative)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "result": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "hex": {
         "type": [
          "null",
          "string"
         ]
        },
        "bits": {
         "type": [
          "null",
          "number"
         ]
        },
        "decimal": {
         "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"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "modulusBits": {
       "type": [
        "null",
        "number"
       ]
      },
      "exponentBits": {
       "type": [
        "null",
        "number"
       ]
      }
     }
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/crypto-math-modular-exponentiation-mod-pow-bd28b208/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)
