Ethoryx API
Ethoryx v2.0 is a REST API for cryptographic prime generation across three contexts: RSA key generation, Ethoryx NTT · Field Primes for FHE, and next-prime optimization. Built on formally proved mathematical structure, it generates primes with 33–79% fewer Miller-Rabin primality tests depending on context and bit size.
The API is live at https://api.ethoryx.io and accepts requests over HTTPS. All responses are JSON.
API status: Operational · https://api.ethoryx.io/v1/status
Quick start
Get a prime in 60 seconds. Create a free account to get your API key, then:
cURL
# Generate a 512-bit prime
curl "https://api.ethoryx.io/v1/generate?bits=512" \
-H "X-API-Key: tg_your_key_here"
Python
import requests
response = requests.get(
"https://api.ethoryx.io/v1/generate",
params={"bits": 2048},
headers={"X-API-Key": "tg_your_key_here"}
)
data = response.json()
prime = int(data["prime"]) # Full integer, ready for RSA
tests = data["miller_rabin_tests"] # e.g. 282 vs ~836 standard
print(f"Prime: {prime}")
print(f"Tests: {tests}")
JavaScript / Node.js
const res = await fetch(
"https://api.ethoryx.io/v1/generate?bits=2048",
{ headers: { "X-API-Key": "tg_your_key_here" } }
);
const { prime, miller_rabin_tests } = await res.json();
console.log(`Prime: ${prime}`);
console.log(`Tests used: ${miller_rabin_tests}`);
pip library (open source)
pip install ethoryx
from ethoryx import prime_generator
p, tests = prime_generator.generate(bits=2048)
print(p) # Full prime integer
Authentication
All generation endpoints require an API key passed as the X-API-Key request header.
-H "X-API-Key: tg_your_key_here"
Keep your API key secret. Do not expose it in client-side JavaScript, public repositories, or logs. If compromised, contact security@ethoryx.io immediately.
The /v1/status and /v1/verify endpoints do not require authentication. The dashboard uses a separate JWT Bearer token for the web interface, this is distinct from your API key.
Get your API key
Create an account to receive your API key by email. Your key starts with tg_ and is valid indefinitely unless you request a rotation.
Error handling
All errors return JSON with an error field and an appropriate HTTP status code.
{
"error": "Invalid or missing API key",
"docs": "https://tesfagrid.io/docs",
"get_key": "https://ethoryx.io/register"
}
| Status | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad request - invalid parameter value |
| 401 | Unauthorized - missing or invalid API key |
| 403 | Forbidden - endpoint requires a higher tier |
| 409 | Conflict - email already registered |
| 429 | Rate limit exceeded or monthly quota reached |
| 500 | Server error - contact support |
Generate a prime
Generates a single cryptographically strong prime number using the Ethoryx Sieve algorithm.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| bits | integer | optional | Bit length of the prime. One of: 256, 512, 1024, 2048, 4096. Default: 512. Maximum depends on your tier. |
| method | string | optional | standard (default) or basic. Standard uses full sieve optimization. Basic uses a reduced filter set. |
Request
curl "https://api.ethoryx.io/v1/generate?bits=2048&method=standard" \
-H "X-API-Key: tg_your_key"
Response
{
"prime": "1775225606...", // Full prime as string (use int() in Python)
"bits": 2048,
"method": "ethoryx_sieve",
"miller_rabin_tests": 282, // vs ~836 standard
"structural_check": true,
"generation_ms": 142.3,
"calls_remaining": 99718,
"generated_at": "2026-04-04T20:25:52Z",
"tier": "pro",
}
The prime field is returned as a string because large integers exceed JavaScript's safe integer range. Convert with BigInt(data.prime) in JS or int(data["prime"]) in Python.
RSA prime · fast mode
Generates an RSA-ready prime using structural pre-filtering combined with an optimized candidate-selection model. Reduces the expected number of primality tests performed.
Returns a single RSA-safe prime. The method=fast mode uses our optimized candidate-selection model; method=standard falls back to the Ethoryx Sieve.
| Parameter | Type | Default | Description |
|---|---|---|---|
| bits | integer | 2048 | Key size: 256, 512, 1024, 2048, 4096 |
| method | string | fast | fast (optimized) or standard (Ethoryx Sieve) |
Ethoryx NTT · Field Prime
Generates primes satisfying q ≡ 1 (mod ntt_mod), required for Number Theoretic Transform operations in FHE, zk-SNARKs, and custom post-quantum parameter sets. All output is NTT-compatible by construction - no post-filtering needed.
| Parameter | Type | Default | Description |
|---|---|---|---|
| bits | integer | 256 | Prime size: 256, 512, 1024, 2048, 4096 |
| ntt_mod | integer | 512 | NTT modulus - must be a power of 2 (2 to 1,048,576). Common: 512, 1024, 4096, 8192, 16384 |
| count | integer | 1 | How many primes to return (1–10 free/starter, up to 50 pro+) |
FHE coefficient modulus chain
Generates a chain of Ethoryx NTT · Field Primes for use as the coefficient modulus in Microsoft SEAL, OpenFHE, or HEAAN. All primes satisfy q ≡ 1 (mod 2n) where n is the polynomial degree. The response includes a ready-to-use SEAL CoeffModulus::Create example.
This endpoint requires Starter tier or above. Each prime in the chain counts as one API call.
| Parameter | Type | Default | Description |
|---|---|---|---|
| n | integer | 4096 | Polynomial degree: 1024, 2048, 4096, 8192, 16384 |
| count | integer | 5 | Primes in chain (1–7 Starter, up to 20 Pro+) |
| bits_each | integer | 55 | Bits per prime: 50–62. Standard SEAL range. |
Next-prime optimization
Returns the predicted location of the next prime given the most recent prime and the gap that preceded it. Based on a proved oscillation property of prime gaps. Public endpoint no API key required.
This endpoint is free and public. No API key required. Rate limited to 60 requests/minute per IP.
| Parameter | Type | Required | Description |
|---|---|---|---|
| last_prime | integer | required | The most recently found prime (must be ≥ 3) |
| last_gap | integer | required | The gap that preceded last_prime; must be an even integer |
RSA key pair
Generates a complete RSA key pair: two independent primes p and q, and the RSA modulus n = p × q. Pro and Enterprise tiers only. Counts as 2 API calls.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| bits | integer | optional | Bit length of each prime. One of: 512, 1024, 2048. Default: 2048. The resulting RSA modulus will be approximately 2× this size. |
Request
curl "https://api.ethoryx.io/v1/generate/rsa-pair?bits=2048" \
-H "X-API-Key: tg_pro_key"
Response
{
"p": "172...821",
"q": "198...473",
"n": "p × q - 4096-bit RSA modulus",
"bits_each": 2048,
"rsa_modulus_bits": 4096,
"total_miller_rabin_tests": 564, // vs ~1672 standard
"structural_p": true,
"structural_q": true,
"generation_ms": 298.4,
"calls_used": 2,
"calls_remaining": 99716
}
Verify a number
Verifies whether any integer is prime and checks structural compliance. Free for all tiers, no API key required.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| n | integer | required | The integer to test. Must be ≥ 2 and ≤ 4096 bits. |
Request
curl "https://api.ethoryx.io/v1/verify?n=999983"
Response
{
"n": "999983",
"is_prime": true,
"bits": 20,
"structural_holds": true,
}
Beat-Cipher Key Generation
Generate deterministic encryption key bits from zeta-zero beat frequency oscillations. Each key bit is computed from the spectral interference between adjacent Riemann zeros as the grid parameter C varies.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| pair | string | required | Zero pair: g4_g5 | g34_g35 | g45_g46 | g1_g2 |
| c_start | integer | optional | Starting grid parameter. Default: 10000 |
| c_step | integer | optional | Step between C values. Default: 50000 |
| n_bits | integer | optional | Number of bits to generate. Max 32. Default: 7 |
Request
curl -X POST "https://api.ethoryx.io/v1/cipher/key" \
-H "Content-Type: application/json" \
-H "X-API-Key: tg_your_key" \
-d '{"pair":"g4_g5","n_bits":7}'
Response
{
"key_binary": "1100111",
"key_hex": "e7",
"key_bits": [1,1,0,0,1,1,1],
"R_values": [
{ "C": 10000, "R": 1.257157, "bit": 1 },
{ "C": 60000, "R": 3.063578, "bit": 1 }
],
"generation_time_ms": 842.3,
"engine": "Ethoryx Spectral Engine"
}
Spectral Anomaly Detection
Analyze any numerical sequence for hidden spectral structure using Lomb-Scargle periodogram combined with matched-filter significance testing. Returns z-scores and peak frequencies against randomized shuffle controls.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| sequence | array | required | Numerical sequence to analyze. Max 500,000 elements. |
| n_freqs | integer | optional | Frequency points to evaluate. Max 2000. Default: 500 |
| n_shuffles | integer | optional | Shuffle randomization tests. Max 300. Default: 100 |
| log_scale | boolean | optional | Use log(index) as time axis. Default: true |
Request
curl -X POST "https://api.ethoryx.io/v1/spectral/analyze" \
-H "Content-Type: application/json" \
-H "X-API-Key: tg_your_key" \
-d '{"sequence":[0.1,0.3,-0.2,0.5,0.1],"n_shuffles":20}'
Response
{
"n_significant": 21,
"max_z": 5.01,
"peak_freqs": [21.7, 41.4, 49.5],
"peak_z_scores": [4.88, 4.74, 3.91],
"analysis_time_ms": 1432.6,
"engine": "Ethoryx Spectral Engine"
}
Account status
curl "https://api.ethoryx.io/v1/account" \
-H "X-API-Key: tg_your_key"
{
"tier": "pro",
"calls_remaining": 99718,
"calls_used": 282,
"calls_limit": 100000,
"max_bits": 2048,
"rate_limit": "120 calls/minute"
}
Register
Creates a new account and generates an API key. The key is returned in the response and emailed to the provided address.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | required | Your full name |
| string | required | Your email address. Must be unique. | |
| password | string | required | Minimum 8 characters. |
| plan | string | optional | One of: free, starter, pro, enterprise. Default: free. |
curl -X POST "https://api.ethoryx.io/v1/auth/register" \
-H "Content-Type: application/json" \
-d '{"name":"Tesfaye","email":"you@example.com","password":"secret123","plan":"free"}'
{
"message": "Registration successful",
"token": "eyJhbGci...", // JWT for dashboard access
"api_key": "tg_Abc123...", // Use this in X-API-Key header
"user": { "id": 1, "name": "Tesfaye", "plan": "free" }
}
Login
curl -X POST "https://api.ethoryx.io/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"secret123"}'
{
"token": "eyJhbGci...",
"user": {
"id": 1, "name": "Tesfaye",
"email": "you@example.com",
"plan": "free",
"api_key": "tg_Abc123..."
}
}
Profile
curl "https://api.ethoryx.io/v1/auth/me" \
-H "Authorization: Bearer eyJhbGci..."
{
"user": { "name": "Tesfaye", "email": "...", "plan": "free", "api_key": "tg_..." },
"account": { "calls_remaining": 98, "calls_limit": 100, "max_bits": 512 }
}
Plans & limits
All plans use the same Ethoryx Sieve algorithm. Higher tiers unlock larger bit sizes, more calls, and faster rate limits.
| Plan | Price | Calls/month | Max bits | Rate limit | RSA pair | Cipher | Spectral |
|---|---|---|---|---|---|---|---|
| Free | $0 | 100 | 512 | 5/min | - | - | - |
| Starter | $29/mo | 10,000 | 1,024 | 30/min | - | ✓ 7-bit | - |
| Pro | $99/mo | 100,000 | 2,048 | 120/min | ✓ | ✓ 32-bit | ✓ |
| Enterprise | $499/mo | Unlimited | 4,096 | 600/min | ✓ | ✓ 128-bit | ✓ |
HSM and hardware licensing available from $50,000 one-time. Contact us.
Structural verification
Every prime generated by Ethoryx satisfies a proved structural property. This is not a heuristic, it is a formally proved constraint, and every API response confirms compliance via the structural_check field.
Why this matters for performance: Standard prime generation tests a wide pool of candidates, most of which are eliminated by the primality test itself. The Ethoryx Sieve eliminates provably non-prime candidates before any expensive test runs, reducing wasted work.
Why this is secure: The sieve is structure-aware, not content-aware. Every valid prime in the target range remains reachable with equal probability. Output entropy is identical to uniform random prime generation. No prime is excluded, no prime is favored.
Verified: zero violations in 348,511 consecutive samples (covering all primes up to 1,000,000). 100% compliance in all benchmark runs. Every API response includes "structural_check": true.
Research notes: tesfagrid.io · Research programme
Security
Cryptographic randomness
All candidates are seeded from Python's secrets module (OS-level CSPRNG). The pre-filtering only removes impossible candidates - the random start is never predictable.
No timing side-channel
The Ethoryx Sieve uses a constant-time step pattern. Unlike rejection sampling, the number of iterations is independent of the secret candidate value. This eliminates the variable-execution-time timing side-channel present in standard rejection-based generators; relevant for HSM and FIPS compliance environments.
Transport security
All API traffic is encrypted over TLS 1.2+. Certificates are managed by Let's Encrypt and auto-renewed. HTTP requests are permanently redirected to HTTPS.
API key security
API keys are stored hashed in the database. They are only shown once at registration and emailed to you. If you believe your key is compromised, email security@ethoryx.io immediately for rotation.
SDKs & libraries
Python library (open source)
pip install ethoryx
The ethoryx library includes the complete open-source implementation of the Ethoryx Sieve algorithm, all nine proved theorems as callable functions, and the prime generator. Source: github.com/Teshgty/tesfagrid-web
REST API (any language)
The REST API works with any HTTP client. No SDK required. Examples above use cURL, Python requests, and JavaScript fetch. The API returns plain JSON - no special parsing needed.
Future SDKs
Go, Rust, and Java SDKs are planned. Contact us if you need a specific language prioritized.
For C integration with OpenSSL's BN_generate_prime_ex() interface, implementation notes are available to commercial licensees. Contact us for the technical dossier.