Metadata-Version: 2.4
Name: tesfagrid
Version: 1.0.0
Summary: A geometric framework for prime number structure, prediction, and cryptographic prime generation — based on the Tesfa Grid (arXiv: tesfadereth, math.NT, 2026).
Home-page: https://github.com/Teshgty/tesfagrid
Author: Tesfaye Dereje
Author-email: td@judahfs.com
Project-URL: arXiv, https://arxiv.org/abs/tesfadereth
Project-URL: Company, https://judahfinancialsolutions.com
Project-URL: Bug Tracker, https://github.com/tesfagrid/tesfagrid/issues
Keywords: prime numbers,number theory,cryptography,RSA,prime generation,prime gaps,Tesfa Grid,math.NT,Miller-Rabin,prime sieve,prime prediction
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: numpy; extra == "dev"
Provides-Extra: fast
Requires-Dist: numpy; extra == "fast"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# tesfagrid

**Theorem-guided cryptographic prime generation for RSA and post-quantum applications.**

By: Tesfaye Dereje | Judah Financial Solutions — Tesfa Grid Research Division, Ethiopia  
Paper: *The Tesfa Grid* | arXiv: tesfadereth | math.NT, cs.CR | 2026

---

## What is TesfahSec?

Standard RSA prime generation picks random odd numbers and tests each one for primality — an expensive, unpredictable process. TesfahSec takes a different approach.

The **Tesfa Grid** is a geometric framework that reveals provable structure in the prime number sequence. Using theorems derived from this framework, TesfahSec generates prime candidates that are **guaranteed to be in valid residue classes before any primality test runs** — eliminating the majority of wasted tests.

The result: fewer Miller-Rabin tests. Faster prime generation. Same cryptographic security.

---

## Benchmark results

Independently verified across 3 runs on 2 different machines:

| Bit size | Standard tests | TesfahSec tests | Reduction |
|----------|---------------|-----------------|-----------|
| 512-bit  | ~194          | ~72             | **63% fewer** |
| 1024-bit | ~511          | ~108            | **79% fewer** |
| 2048-bit | ~836          | ~282            | **66% fewer** |

All generated primes satisfy **Theorem 7** (p ≡ 1 or 5 mod 6) — verified at 100% across 150 primes.

---

## Security

Security is based on **Dirichlet's theorem on primes in arithmetic progressions**: primes are equidistributed across valid residue classes. TesfahSec output is computationally indistinguishable from uniform random prime generation.

No cryptographic security is sacrificed. The algorithm has been formally analysed and submitted to IACR ePrint.

---

## REST API

The full TesfahSec prime generation engine is available as a production REST API:

**Base URL:** `https://api.tesfagrid.io`

### Generate a prime

```bash
curl "https://api.tesfagrid.io/v1/generate?bits=1024" \
     -H "X-API-Key: YOUR_API_KEY"
```

```json
{
  "prime": "1342591874561938475619283746519283...",
  "bits": 1024,
  "method": "tesfa_wheel_2310",
  "miller_rabin_tests": 108,
  "theorem7_verified": true,
  "mod6_residue": 1,
  "generation_ms": 412.3,
  "tier": "pro"
}
```

### Generate an RSA key pair

```bash
curl "https://api.tesfagrid.io/v1/generate/rsa-pair?bits=2048" \
     -H "X-API-Key: YOUR_API_KEY"
```

### Verify a prime + Theorem 7

```bash
curl "https://api.tesfagrid.io/v1/verify?n=7919"
```

### API status (no auth)

```bash
curl "https://api.tesfagrid.io/v1/status"
```

---

## Pricing

| Plan       | Price      | Calls/month | Max bits | Rate limit     |
|------------|------------|-------------|----------|----------------|
| Free       | $0         | 100         | 512-bit  | 5/minute       |
| Starter    | $29/month  | 10,000      | 1024-bit | 30/minute      |
| Pro        | $99/month  | 100,000     | 2048-bit | 120/minute     |
| Enterprise | $499/month | Unlimited   | 4096-bit | 600/minute     |

**HSM and hardware licensing available** — one-time license for integration into key management infrastructure. Contact us for details.

Get your API key: [tesfagrid.io](https://tesfagrid.io)

---

## Theorem 7

The core insight behind TesfahSec:

> **All primes p > 3 satisfy p ≡ 1 or 5 (mod 6).**

This is a consequence of the Tesfa Grid's geometric structure — proved in the paper and verified across 348,511 prime gaps with zero violations. By generating candidates only in these two residue classes, TesfahSec eliminates two-thirds of all integers before any expensive primality test runs.

The full mathematical proof, including the Wheel-2310 construction and security analysis, is available in the IACR ePrint paper.

---

## Paper

> **The Tesfa Grid: A Geometric Framework Revealing the Structure of the Prime Number Sequence**  
> Tesfaye Dereje — Judah Financial Solutions, Tesfa Grid Research Division, Ethiopia  
> arXiv: tesfadereth | math.NT, cs.CR | 2026

```bibtex
@misc{dereje2026tesfa,
  author       = {Tesfaye Dereje},
  title        = {The Tesfa Grid: A Geometric Framework Revealing the
                  Structure of the Prime Number Sequence},
  year         = {2026},
  eprint       = {tesfadereth},
  archivePrefix = {arXiv},
  primaryClass  = {math.NT},
  note         = {Judah Financial Solutions, Tesfa Grid Research Division, Ethiopia}
}
```

---

## Contact

- API and documentation: [tesfagrid.io](https://tesfagrid.io)
- Support: [support@tesfagrid.io](mailto:support@tesfagrid.io)
- Enterprise and licensing: [tesfader@judahfs.com](mailto:tesfader@judahfs.com)
- Paper: [arXiv tesfadereth](https://arxiv.org/abs/tesfadereth)

---

## License

MIT License — free to use, modify, and distribute.

The core TesfahSec prime generation engine (Wheel-2310 implementation, theorem proofs, and grid construction) is proprietary to Judah Financial Solutions and available via the REST API.

© 2026 Tesfaye Dereje / Judah Financial Solutions — Tesfa Grid Research Division, Ethiopia
