{"openapi":"3.1.0","info":{"title":"Crypto Math","version":"1.0.0","description":"Modular arithmetic, primality, CRT, curve parameters, RSA sizing, encodings, entropy and check digits. One call, one computed answer, no accounts or API keys. Machine-payable over x402.","x-guidance":"Crypto Math: Modular arithmetic, primality, CRT, curve parameters, RSA sizing, encodings, entropy and check digits. Use /mod-pow for modular exponentiation, /mod-inverse for inverses, /gcd-extended for gcd and lcm with Bezout coefficients, /prime for deterministic Miller-Rabin and next or previous prime, /crt for the Chinese remainder theorem, /encoding for hex, base64 and base64url conversion with length checks, /ec-params for secp256k1, P-256 and P-384 public parameters with an on-curve check, /rsa-arith for modulus size, exponent validity and toy RSA, /entropy for Shannon entropy of a frequency table and /check-digits for Luhn and ISO 7064 mod 97 check digits. Each paid GET returns a computed verdict with the reasons, the source and what was NOT checked. A verdict of UNVERIFIED means a lookup failed: treat it as unknown. No account or key: pay per call in USDC over x402."},"servers":[{"url":"https://crypto-math.x402tookit.com"}],"paths":{"/check-digits":{"get":{"operationId":"check_digits","summary":"Generate or validate Luhn and ISO 7064 mod 97-10 (IBAN style) check digits from the string you supply.","description":"Generate or validate Luhn and ISO 7064 mod 97-10 (IBAN style) check digits from the string you supply.","tags":["luhn","iban","check-digit","iso-7064"],"parameters":[{"name":"scheme","in":"query","required":true,"description":"luhn, mod97-10 or iban","schema":{"type":"string"}},{"name":"value","in":"query","required":true,"description":"luhn: digits; mod97-10: digits and letters; iban: country code + BBAN to generate, or a full IBAN to validate. Use sample numbers only","schema":{"type":"string"}},{"name":"action","in":"query","required":false,"description":"generate (default; value has no check digits yet) or validate (value includes them)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"scheme":{"type":["null","string"]},"checkDigits":{"type":["null","string"]},"iban":{"type":["null","string"]},"countryCode":{"type":["null","string"]},"ibanLength":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"IBAN check digits are 82: GB82WEST12345698765432.","reasons":["Per ISO 13616: BBAN, then country code, then 00, converted with A=10 to Z=35; the check digits are 98 minus that number mod 97.","Country-specific length and BBAN layout are not validated."],"scheme":"iban","checkDigits":"82","iban":"GB82WEST12345698765432","countryCode":"GB","ibanLength":22,"degraded":false,"notChecked":["that a number is issued, active or belongs to anyone: a passing check digit proves only arithmetic consistency","country-specific IBAN length and BBAN structure, bank codes and national check digits","…1 more"],"source":"Luhn (ISO/IEC 7812-1 Annex B) and ISO 7064 MOD 97-10 (as used by ISO 13616 IBAN), computed locally","asOf":"2026-10-11T23:46:27.454Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/check-digits"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/check-digits"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/check-digits"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/check-digits"}}]}}},"/crt":{"get":{"operationId":"crt","summary":"Solve x = a1 (mod m1), x = a2 (mod m2), ... with the Chinese remainder theorem, coprime or not.","description":"Solve x = a1 (mod m1), x = a2 (mod m2), ... with the Chinese remainder theorem, coprime or not.","tags":["crt","chinese-remainder","congruence","number-theory"],"parameters":[{"name":"congruences","in":"query","required":true,"description":"Comma-separated residue:modulus pairs, e.g. 2:3,3:5,2:7 (2 to 12 pairs)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"x":{"type":["null","string"]},"modulus":{"type":["null","string"]},"equation":{"type":["null","string"]},"equationCount":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"x = 23 (mod 105).","reasons":["Solved by merging the congruences one at a time with the extended Euclidean algorithm.","Every integer x + k*M is also a solution; the smallest non-negative one is returned.","…1 more"],"x":"23","modulus":"105","equation":"x = 23 (mod 105)","equationCount":3,"degraded":false,"notChecked":["that the moduli are pairwise coprime (they need not be; compatibility is checked instead)","negative moduli (not accepted)"],"source":"generalised Chinese remainder theorem on JavaScript BigInt, computed locally","asOf":"2026-10-11T23:46:27.714Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/crt"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/crt"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/crt"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/crt"}}]}}},"/ec-params":{"get":{"operationId":"ec_params","summary":"secp256k1, P-256 and P-384 public parameters (p, n, G) from SEC 2, with an on-curve check of a public point.","description":"secp256k1, P-256 and P-384 public parameters (p, n, G) from SEC 2, with an on-curve check of a public point.","tags":["secp256k1","ecdsa","elliptic-curve","sec2"],"parameters":[{"name":"curve","in":"query","required":true,"description":"secp256k1, secp256r1 (P-256) or secp384r1 (P-384)","schema":{"type":"string"}},{"name":"publicKey","in":"query","required":false,"description":"PUBLIC key hex: 04||X||Y uncompressed or 02/03||X compressed; not a private scalar","schema":{"type":"string"}},{"name":"x","in":"query","required":false,"description":"Point x coordinate, decimal or 0x hex (give with y)","schema":{"type":"string"}},{"name":"y","in":"query","required":false,"description":"Point y coordinate, decimal or 0x hex (give with x)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"params":{"type":["null","object"],"properties":{"name":{"type":["null","string"]},"aliases":{"type":["array","null"],"items":{"type":"string"}},"oid":{"type":["null","string"]},"fieldBits":{"type":["null","number"]},"securityStrengthBits":{"type":["null","number"]},"p":{"type":["null","object"],"properties":{"hex":{"type":["null","string"]},"decimal":{"type":["null","string"]}}},"a":{"type":["null","object"],"properties":{"hex":{"type":["null","string"]}}},"b":{"type":["null","object"],"properties":{"hex":{"type":["null","string"]}}},"generator":{"type":["null","object"],"properties":{"x":{"type":["null","string"]},"y":{"type":["null","string"]}}},"order":{"type":["null","object"],"properties":{"hex":{"type":["null","string"]},"decimal":{"type":["null","string"]}}},"cofactor":{"type":["null","number"]},"equation":{"type":["null","string"]},"commonUse":{"type":["null","string"]}}},"point":{"type":["null","object"],"properties":{"valid":{"type":["boolean","null"]},"x":{"type":["null","string"]},"y":{"type":["null","string"]},"yParity":{"type":["null","string"]},"isGenerator":{"type":["boolean","null"]},"uncompressedHex":{"type":["null","string"]},"compressedHex":{"type":["null","string"]}}},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"ON_CURVE","summary":"The point is on secp256k1.","reasons":["Parameters are the published SEC 2 v2 / FIPS 186-4 values; cofactor is 1, so any on-curve point other than infinity has order n."],"params":{"name":"secp256k1","aliases":["secp256k1","K-256"],"oid":"1.3.132.0.10","fieldBits":256,"securityStrengthBits":128,"p":{"hex":"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","decimal":"115792089237316195423570985008687907853269984665640564039457584007908834671663"},"a":{"hex":"0000000000000000000000000000000000000000000000000000000000000000"},"b":{"hex":"0000000000000000000000000000000000000000000000000000000000000007"},"generator":{"x":"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","y":"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"},"order":{"hex":"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","decimal":"115792089237316195423570985008687907852837564279074904382605163141518161494337"},"cofactor":1,"equation":"y^2 = x^3 + 7 (mod p)","commonUse":"Bitcoin, Ethereum and many other chains (ECDSA and Schnorr)"},"point":{"valid":true,"x":"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","y":"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","yParity":"even","isGenerator":true,"uncompressedHex":"0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","compressedHex":"0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"},"degraded":false,"notChecked":["that the point belongs to anyone or was generated from a real private key","the point at infinity encoding","…2 more"],"source":"SEC 2 v2 (Certicom) and NIST FIPS 186-4 curve parameters, point check computed locally","asOf":"2026-10-11T23:46:27.980Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/ec-params"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/ec-params"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/ec-params"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/ec-params"}}]}}},"/encoding":{"get":{"operationId":"encoding","summary":"Convert public bytes between hex, base64 and base64url (RFC 4648) with strict decoding and expected-length check.","description":"Convert public bytes between hex, base64 and base64url (RFC 4648) with strict decoding and expected-length check.","tags":["base64url","hex","bytes","encoding"],"parameters":[{"name":"input","in":"query","required":true,"description":"The value to convert (a hash, public key, nonce or text; never a secret)","schema":{"type":"string"}},{"name":"from","in":"query","required":true,"description":"Input format: hex, base64, base64url or utf8","schema":{"type":"string"}},{"name":"expectBytes","in":"query","required":false,"description":"Expected byte length to verify, e.g. 32 for a SHA-256 digest","schema":{"type":"integer"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"byteLength":{"type":["null","number"]},"bitLength":{"type":["null","number"]},"hex":{"type":["null","string"]},"base64":{"type":["null","string"]},"base64url":{"type":["null","string"]},"bytes":{"type":["array","null"],"items":{"type":"number"}},"bytesTruncated":{"type":["boolean","null"]},"canonical":{"type":["boolean","null"]},"lengthExpected":{"type":["null","number"]},"lengthMatches":{"type":["boolean","null"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"6 byte(s) (48 bits).","reasons":["Base64 and base64url encode 3 bytes as 4 characters; base64url swaps + and / for - and _ and usually drops the = padding.","Length check passed: 6 bytes."],"byteLength":6,"bitLength":48,"hex":"666f6f626172","base64":"Zm9vYmFy","base64url":"Zm9vYmFy","bytes":[102,111],"bytesTruncated":false,"canonical":true,"lengthExpected":6,"lengthMatches":true,"degraded":false,"notChecked":["what the bytes mean: a 16, 24 or 32 byte value looks the same whether it is a digest, a public value or a secret key, so send public values only","ASN.1, PEM or JWK structure","…1 more"],"source":"RFC 4648 encodings, computed locally","asOf":"2026-10-11T23:46:28.243Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/encoding"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/encoding"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/encoding"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/encoding"}}]}}},"/entropy":{"get":{"operationId":"entropy","summary":"Shannon entropy in bits per symbol from a frequency table, plus min-entropy, collision entropy and efficiency.","description":"Shannon entropy in bits per symbol from a frequency table, plus min-entropy, collision entropy and efficiency.","tags":["entropy","shannon","information-theory","frequency"],"parameters":[{"name":"table","in":"query","required":true,"description":"Comma-separated counts or probabilities, optionally label:count, e.g. a:5,b:3,c:2 or 0.5,0.25,0.25 (1 to 1000 symbols)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"entropyBitsPerSymbol":{"type":["null","number"]},"maxEntropyBits":{"type":["null","number"]},"efficiency":{"type":["null","number"]},"redundancyBits":{"type":["null","number"]},"minEntropyBits":{"type":["null","number"]},"collisionEntropyBits":{"type":["null","number"]},"perfectBitsToEncodeOneSymbol":{"type":["null","number"]},"symbols":{"type":["null","number"]},"symbolsWithZeroCount":{"type":["null","number"]},"sampleSize":{"type":["null","number"]},"totalInformationBits":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"Shannon entropy 1.75 bits per symbol over 4 symbol(s) (maximum 2).","reasons":["H = -sum p*log2(p) over symbols with non-zero probability; counts are normalised to probabilities.","An optimal symbol code averages between H and H + 1 bits per symbol (Shannon source coding theorem)."],"entropyBitsPerSymbol":1.75,"maxEntropyBits":2,"efficiency":0.875,"redundancyBits":0.25,"minEntropyBits":1,"collisionEntropyBits":1.540568381,"perfectBitsToEncodeOneSymbol":1.75,"symbols":4,"symbolsWithZeroCount":0,"sampleSize":8,"totalInformationBits":14,"degraded":false,"notChecked":["that the table reflects the real source: entropy of a sample is not the entropy of how a secret was chosen","dependence between symbols (this is zeroth-order, memoryless entropy)","…1 more"],"source":"Shannon (1948) entropy H = -sum p log2 p, computed locally","asOf":"2026-10-11T23:46:28.507Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/entropy"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/entropy"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/entropy"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/entropy"}}]}}},"/gcd-extended":{"get":{"operationId":"gcd_extended","summary":"gcd, lcm and extended-Euclid Bezout coefficients of two integers, plus gcd/lcm of up to 20 more.","description":"gcd, lcm and extended-Euclid Bezout coefficients of two integers, plus gcd/lcm of up to 20 more.","tags":["gcd","lcm","euclid","bezout"],"parameters":[{"name":"a","in":"query","required":true,"description":"First non-negative whole number (decimal or 0x hex)","schema":{"type":"string"}},{"name":"b","in":"query","required":true,"description":"Second non-negative whole number","schema":{"type":"string"}},{"name":"more","in":"query","required":false,"description":"Comma-separated further non-negative numbers for the combined gcd and lcm (up to 20)","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"gcd":{"type":["null","string"]},"lcm":{"type":["null","string"]},"bezoutX":{"type":["null","string"]},"bezoutY":{"type":["null","string"]},"coprime":{"type":["boolean","null"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"gcd(a, b) = 2, lcm(a, b) = 5520; Bezout: a*(-9) + b*(47) = 2.","reasons":["Coefficients come from the extended Euclidean algorithm; a*x + b*y equals the gcd.","Add numbers in the more parameter for a combined gcd and lcm."],"gcd":"2","lcm":"5520","bezoutX":"-9","bezoutY":"47","coprime":false,"degraded":false,"notChecked":["negative numbers (not accepted)","which of the infinitely many Bezout pairs you want: this returns the one the standard algorithm produces"],"source":"extended Euclidean algorithm on JavaScript BigInt, computed locally","asOf":"2026-10-11T23:46:28.758Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/gcd-extended"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/gcd-extended"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/gcd-extended"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/gcd-extended"}}]}}},"/mod-inverse":{"get":{"operationId":"mod_inverse","summary":"Modular multiplicative inverse of a mod m, or the gcd that proves none exists.","description":"Modular multiplicative inverse of a mod m, or the gcd that proves none exists.","tags":["modular","inverse","euclid","number-theory"],"parameters":[{"name":"a","in":"query","required":true,"description":"Number to invert, whole number (decimal or 0x hex)","schema":{"type":"string"}},{"name":"mod","in":"query","required":true,"description":"Modulus, whole number of at least 2","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"result":{"type":["null","object"],"properties":{"decimal":{"type":["null","string"]},"hex":{"type":["null","string"]},"bits":{"type":["null","number"]}}},"gcd":{"type":["null","object"],"properties":{"decimal":{"type":["null","string"]},"hex":{"type":["null","string"]},"bits":{"type":["null","number"]}}},"check":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"The inverse of a mod m is 2753.","reasons":["Found with the extended Euclidean algorithm: a*x + m*y = 1, so x is the inverse.","Check: (a * result) mod m = 1."],"result":{"decimal":"2753","hex":"0xac1","bits":12},"gcd":{"decimal":"1","hex":"0x1","bits":1},"check":"1","degraded":false,"notChecked":["side channels: this is not constant-time, so never use it with a secret value","whether the modulus is prime"],"source":"extended Euclidean algorithm on JavaScript BigInt, computed locally","asOf":"2026-10-11T23:46:29.024Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-inverse"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-inverse"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-inverse"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-inverse"}}]}}},"/mod-pow":{"get":{"operationId":"mod_pow","summary":"Modular exponentiation base^exp mod m for big integers, decimal or 0x hex, up to 4096 bits.","description":"Modular exponentiation base^exp mod m for big integers, decimal or 0x hex, up to 4096 bits.","tags":["modular","exponentiation","bigint","number-theory"],"parameters":[{"name":"base","in":"query","required":true,"description":"Base, whole number (decimal or 0x hex, may be negative)","schema":{"type":"string"}},{"name":"exp","in":"query","required":true,"description":"Exponent, non-negative whole number","schema":{"type":"string"}},{"name":"mod","in":"query","required":true,"description":"Modulus, whole number of at least 1","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"result":{"type":["null","object"],"properties":{"decimal":{"type":["null","string"]},"hex":{"type":["null","string"]},"bits":{"type":["null","number"]}}},"modulusBits":{"type":["null","number"]},"exponentBits":{"type":["null","number"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"COMPUTED","summary":"base^exp mod m = 445.","reasons":["Computed by square-and-multiply; a negative base is first reduced into 0..m-1."],"result":{"decimal":"445","hex":"0x1bd","bits":9},"modulusBits":9,"exponentBits":4,"degraded":false,"notChecked":["whether the modulus is prime or the base is a unit","side channels: this is not constant-time, so never use it with a secret exponent","…1 more"],"source":"square-and-multiply on JavaScript BigInt, computed locally","asOf":"2026-10-11T23:46:29.288Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-pow"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-pow"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-pow"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/mod-pow"}}]}}},"/prime":{"get":{"operationId":"prime","summary":"Primality test (deterministic Miller-Rabin below 2^64) plus the next and previous prime, with BigInt.","description":"Primality test (deterministic Miller-Rabin below 2^64) plus the next and previous prime, with BigInt.","tags":["prime","miller-rabin","primality","number-theory"],"parameters":[{"name":"n","in":"query","required":true,"description":"Whole number to test, decimal or 0x hex, up to 1024 bits","schema":{"type":"string"}},{"name":"neighbors","in":"query","required":false,"description":"true also returns the next and previous prime (numbers up to 512 bits)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"n":{"type":["null","object"],"properties":{"decimal":{"type":["null","string"]},"hex":{"type":["null","string"]},"bits":{"type":["null","number"]}}},"isPrime":{"type":["boolean","null"]},"deterministic":{"type":["boolean","null"]},"nextPrime":{"type":["null","string"]},"previousPrime":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"PRIME","summary":"18446744073709551557 is prime (deterministic test).","reasons":["Below 2^64 the first 12 prime bases form a proven deterministic Miller-Rabin set, so the answer is exact."],"n":{"decimal":"18446744073709551557","hex":"0xffffffffffffffc5","bits":64},"isPrime":true,"deterministic":true,"nextPrime":"18446744073709551629","previousPrime":"18446744073709551533","degraded":false,"notChecked":["a primality certificate: above 2^64 a PROBABLY_PRIME answer is not a proof","primes of cryptographic quality for key generation (use a vetted library and a secure random source)"],"source":"Miller-Rabin with fixed prime bases (first 12 below 2^64, a proven deterministic set; first 16 above), computed locally","asOf":"2026-10-11T23:46:29.555Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/prime"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/prime"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/prime"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/prime"}}]}}},"/rsa-arith":{"get":{"operationId":"rsa_arith","summary":"RSA public key arithmetic: modulus bits, exponent validity, NIST strength; or a labelled toy RSA with tiny primes.","description":"RSA public key arithmetic: modulus bits, exponent validity, NIST strength; or a labelled toy RSA with tiny primes.","tags":["rsa","key-size","modulus","educational"],"parameters":[{"name":"mode","in":"query","required":true,"description":"public (check a public modulus n and exponent e) or toy (educational RSA from tiny primes p and q)","schema":{"type":"string"}},{"name":"n","in":"query","required":false,"description":"public mode: the PUBLIC modulus, decimal or 0x hex, up to 8192 bits","schema":{"type":"string"}},{"name":"e","in":"query","required":false,"description":"public exponent (default 65537; required in toy mode)","schema":{"type":"string"}},{"name":"p","in":"query","required":false,"description":"toy mode: first tiny prime, below 65536","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"toy mode: second tiny prime, below 65536","schema":{"type":"string"}},{"name":"message","in":"query","required":false,"description":"toy mode: a small integer below n to encrypt and decrypt, to show the round trip","schema":{"type":"string"}}],"responses":{"200":{"description":"The answer.","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":["null","string"]},"summary":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"educationalOnly":{"type":["boolean","null"]},"n":{"type":["null","string"]},"phi":{"type":["null","string"]},"carmichaelLambda":{"type":["null","string"]},"e":{"type":["null","string"]},"d":{"type":["null","string"]},"dCarmichael":{"type":["null","string"]},"steps":{"type":["array","null"],"items":{"type":"string"}},"message":{"type":["null","string"]},"ciphertext":{"type":["null","string"]},"decrypted":{"type":["null","string"]},"roundTrip":{"type":["boolean","null"]},"degraded":{"type":["boolean","null"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"source":{"type":["null","string"]},"asOf":{"type":["null","string"]},"disclaimer":{"type":["null","string"]}}},"example":{"verdict":"TOY_RSA","summary":"Toy RSA: n = 3233, phi = 3120, d = 2753. Encrypting 65 gives 2790, which decrypts back to 65.","reasons":["EDUCATIONAL TOY ONLY: primes this small are factored instantly. Never use these numbers to protect anything, and never send real key material here."],"educationalOnly":true,"n":"3233","phi":"3120","carmichaelLambda":"780","e":"17","d":"2753","dCarmichael":"413","steps":["n = p*q","phi = (p-1)(q-1)","…3 more"],"message":"65","ciphertext":"2790","decrypted":"65","roundTrip":true,"degraded":false,"notChecked":["whether a modulus is a product of two strong random primes (only size, parity and small factors are checked)","padding schemes (OAEP, PSS): textbook RSA without padding is insecure by design","…1 more"],"source":"textbook RSA arithmetic and NIST SP 800-57 Part 1 Rev. 5 strength table, computed locally","asOf":"2026-10-11T23:46:29.821Z","disclaimer":"Screening signal computed from the named public source. Not financial, legal or investment advice; provided as is. Verify at the source before acting."}}}},"400":{"description":"A parameter was missing or out of range."},"402":{"description":"Payment Required"},"502":{"description":"The upstream source failed or timed out."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.0200"},"protocols":[{"x402":{"network":"eip155:8453","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/rsa-arith"}},{"x402":{"network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/rsa-arith"}},{"x402":{"network":"eip155:137","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/rsa-arith"}},{"x402":{"network":"eip155:42161","scheme":"exact","currency":"USDC","endpoint":"https://crypto-math.x402tookit.com/rsa-arith"}}]}}}}}