# Crypto Math: Modular Multiplicative Inverse

> Crypto Math: Modular Multiplicative Inverse 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-30).

Computes the modular multiplicative inverse of a mod m, or returns the GCD proving no inverse exists when gcd(a,m) > 1.

## Facts

- Endpoint: GET https://crypto-math.x402tookit.com/mod-inverse?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/crypto-math-modular-multiplicative-inverse-87efc29e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_eAlvNcsNz01g9aO9bgSAi

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-multiplicative-inverse-87efc29e
```

Example prompt: What is the modular multiplicative inverse of 17 mod 3120? If it doesn't exist, tell me the GCD that proves it.

## When to prefer this

Choose this endpoint when you need to compute a modular multiplicative inverse for cryptographic or number-theoretic purposes — especially for RSA key derivation, elliptic curve scalar inversion, or any modular arithmetic where you also want confirmation that the inverse is valid (gcd=1). It handles both decimal and 0x hex inputs and explicitly returns the GCD when no inverse exists, making it useful for pre-flight checks in cryptographic protocols.

## Known failure modes

- Missing required parameter 'a' or 'mod' returns an error
- Modulus less than 2 is rejected as invalid
- Non-integer or malformed hex input causes a parse error
- When gcd(a,m) > 1, no inverse exists and the response returns the GCD instead of a result
- Very large integers may exceed bit-size limits

## How this service works

Modular multiplicative inverse of a mod m, or the gcd that proves none exists.

## Output

Returns a JSON object with a 'result' field containing the modular inverse (in decimal, hex, and bit-length), a 'gcd' field (null if gcd=1, otherwise the GCD value showing why no inverse exists), a 'verdict' string, a human-readable 'summary', and optional 'check' and 'reasons' fields. The 'degraded' flag indicates if the result is partial.

## 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": [
      "a",
      "mod"
     ],
     "properties": {
      "a": {
       "type": "string",
       "description": "Number to invert, whole number (decimal or 0x hex)"
      },
      "mod": {
       "type": "string",
       "description": "Modulus, whole number of at least 2"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "gcd": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "hex": {
         "type": [
          "null",
          "string"
         ]
        },
        "bits": {
         "type": [
          "null",
          "number"
         ]
        },
        "decimal": {
         "type": [
          "null",
          "string"
         ]
        }
       }
      },
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "check": {
       "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",
        
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/crypto-math-modular-multiplicative-inverse-87efc29e/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)
