What Happens If P = NP? What It Would Mean for API Security

No proof of P = NP or fast factoring exists. Here's what each would break in an API stack, from TLS to JWTs and webhooks, and how to test your algorithm allowlist now.

Ashley Innocent

Ashley Innocent

30 November 2026

What Happens If P = NP? What It Would Mean for API Security

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

What happens if P = NP? In principle, every cryptographic scheme your API relies on could be broken: RSA, elliptic curves, hashes, HMAC and even the new post-quantum algorithms. In practice, nothing has happened yet. As of November 30, 2026, no paper, code or lab statement claims a proof that P = NP or a polynomial-time factoring algorithm. What’s circulating is a rumour, so this post covers what it would mean if it were true, and the one change worth making to your API this week either way.

The rumour, and its status

In late November, Dan Hollick’s widely shared explainer What happens if P = NP? walked a general audience through the maths, against a backdrop of talk that an AI lab may be sitting on fast integer factoring. The closest thing to a primary source is Scott Aaronson, a complexity theorist at UT Austin. In a blog comment on November 24 he said he’d heard many rumours along those lines and didn’t know how much to credit them.

On November 27 he went further in a post on his blog: the result he has specific information about “will not lead to imminent danger for any currently deployed cryptosystems.” He also wrote that the claimed proof that VP ≠ VNP, an algebraic cousin of the question, is a step toward P ≠ NP, which is the opposite of the rumour.

So treat it as unverified. RSA is not broken today, and nobody has published a proof either way.

P vs NP explained in plain words

P vs NP asks whether every problem whose answer is easy to check is also easy to solve. P is the set of problems a computer can solve in polynomial time. NP is the set whose solutions can be verified in polynomial time. Whether the two sets are equal is one of the Clay Institute’s Millennium Prize problems.

Here’s an example from your own stack. Someone hands you a 64-character hex string and says it’s the random API secret behind a SHA-256 hash in your database. Checking takes one hash call. Finding that secret from the hash alone has no known shortcut: you’d guess for longer than the universe has existed. Checking is cheap and solving is expensive, and modern cryptography is built on that gap.

If P = NP, the gap closes for every problem in NP. That’s why the question matters to anyone who signs a token.

Schema: P sits inside NP. Factoring, discrete log and lattice problems sit in NP but outside the NP-complete group, and every NP problem reduces to an NP-complete one like 3-SAT

P vs NP and cryptography: what would and would not break

Headlines blur four separate claims. Here they are, kept apart.

Factoring is not known to be NP-complete. Factoring (behind RSA) and discrete log (behind Diffie-Hellman, ECDHE and ECDSA) are in NP, but nobody has shown they’re among the hardest NP problems. Most theorists think they aren’t. So a fast factoring algorithm would break RSA without settling P vs NP.

P = NP would reach well beyond RSA. If P = NP, one-way functions can’t exist. A one-way function is easy to compute and hard to invert, and almost all of cryptography assumes they exist: hash functions, HMAC, block ciphers, and the lattice problems under NIST’s post-quantum standards such as FIPS 203 (ML-KEM). In principle, all of them would fall. Swapping RSA for ML-KEM wouldn’t save you.

“Polynomial” doesn’t have to mean fast. An algorithm that takes n^100 steps is polynomial and useless. A proof could also be non-constructive: it could show a fast algorithm exists without handing you one.

P ≠ NP wouldn’t prove today’s cryptography safe. Cryptography needs problems that are hard on almost every input, not just on a few worst cases, and it needs specific problems like factoring to be hard. P ≠ NP guarantees neither of those things.

Is RSA broken? Where this lives in your API stack

No. And here’s where each assumption shows up in a typical API, so you know what to inventory.

Layer Typical algorithm Rests on Fast factoring alone P = NP
TLS key exchange ECDHE (X25519, P-256) Discrete log Safe Broken in principle
TLS certificates RSA-2048 or ECDSA Factoring or discrete log RSA certs break Broken in principle
JWT signing RS256, PS256 Factoring Breaks Broken in principle
JWT signing ES256, EdDSA Discrete log Safe Broken in principle
JWT signing HS256 HMAC-SHA256 Safe Broken in principle
Webhook signatures HMAC-SHA256 One-way functions Safe Broken in principle
OAuth client assertions private_key_jwt (RS256, ES256) Factoring or discrete log RS256 breaks Broken in principle
SSH and CI deploy keys RSA or Ed25519 Factoring or discrete log RSA keys break Broken in principle
API keys Random bearer secret No public-key maths Safe, but it travels over TLS Stored hashes become invertible

A factoring break hits RSA everywhere at once, from certificates to RS256 tokens to old deploy keys. API keys are just random bytes, but they’re only as safe as the TLS channel carrying them. If you’re unsure where your keys sit on that spectrum, our guide to API keys vs bearer tokens covers the difference.

Sequence diagram: a client opens TLS with an ECDHE key exchange and a signed certificate, sends a JWT the API verifies with RS256 or ES256, and the API signs a webhook with HMAC-SHA256 that the partner checks; notes mark which step rests on factoring, discrete log or one-way functions

What to do now: crypto-agility you can test

You can’t fix a break in mathematics, and Apidog can’t protect you from one either. What you can control is how fast you swap an algorithm and how sure you are that nothing still accepts the old one. That’s crypto-agility, and you need it anyway: the NIST post-quantum migration asks for the same work, rumour or no rumour.

The weak spot in most APIs isn’t the algorithm. It’s the verifier that trusts the token’s own alg header, or that never got its allowlist updated. RFC 8725, the JWT best current practice, says plainly that libraries must let you fix the accepted algorithms and must not trust the header. Tests are how you prove your API does that today, and how you’ll prove it again after an emergency swap.

Let your coding agent write the tests with Apidog CLI

Your coding agent already reads your OpenAPI spec. Give it Apidog CLI and it can write and run these checks for you. Set it up once:

npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com   # pick your agent when prompted

Then give Claude Code, Codex or your agent of choice one prompt:

Read our OpenAPI spec and list every security scheme and the JWT algorithms each one accepts.
Then create an Apidog test scenario in project <projectId> called "JWT algorithm gate" that
calls a protected endpoint with: a token with alg "none", a token signed with an algorithm that
is not on our allowlist, and an expired token, and asserts each one is rejected. Add a step that
sends a webhook with a tampered body and asserts the signature check fails. Read the CLI schema
and validate the payload before writing. Run it and summarize any check that passes when it
should fail.

The agent reads the schema, validates its payload, writes the scenario and runs it:

apidog cli-schema get test-scenario-create
apidog test-scenario create --project <projectId> --file meta.json
apidog cli-schema validate test-scenario-update --file steps.json
apidog test-scenario update <scenarioId> --project <projectId> --file steps.json
apidog run -t <scenarioId> --project <projectId> -e <envId> -r cli,junit

Here’s a real run on our sandbox project. To show a real verifier at work, the three token steps call Google’s public tokeninfo endpoint, which checks ID token signatures and expiry: the alg: none token, the HS256 token and the expired token all come back as 400 invalid_token, and all 6 assertions pass.

Apidog CLI running the JWT algorithm gate scenario on a sandbox project: an alg none token, an HS256 token and an expired token each get 400 invalid_token, 6 of 6 assertions pass

Add the same apidog run ... -r junit line to your pipeline (see Apidog CLI in CI/CD), and every deploy re-proves that your verifier refuses what it should. If you ever have to drop RS256 in a hurry, change the allowlist, add an RS256 token to the “must be refused” list and watch the run go green. Every flag is listed in the apidog run command reference.

Once one agent can write and run these checks, a team can spread the work: Sharkly is a board where you assign tasks like “add the JWT algorithm gate to the billing API” to coding agents that run on your own computers with your own Claude Code or Codex plan, several in parallel, and review what they ship before it merges. It’s free to start.

Short-lived tokens and fast rotation limit any break

Whatever breaks, and whenever, two habits cap the damage. Short token lifetimes mean a forged or stolen token stops working within minutes, not months. Fast key rotation means you can retire a signing key in one deploy instead of one quarter. Publish signing keys through a JWKS endpoint with a kid on every token, so clients pick up a new key without a release.

If you’ve never rotated a signing key under time pressure, rehearse it. Our API key rotation best practices walk through the overlap window that keeps rotation free of downtime. Run the JWT algorithm gate before and after the rehearsal, so you know the old key is really gone.

Conclusion

Nobody has proved P = NP, and nobody has published fast factoring. If either happens, the teams that can swap an algorithm in a day and prove the swap with a test will be fine. Inventory your algorithms with the table above, put the JWT algorithm gate in CI and keep token lifetimes short. That work pays off for the post-quantum move whether or not the rumour is true.

FAQ

Is RSA broken today? No. As of November 30, 2026, no paper, code or demonstration shows polynomial-time factoring. Aaronson’s November 27 post says the result he knows of won’t endanger currently deployed cryptosystems.

Would post-quantum algorithms survive P = NP? Not in principle. ML-KEM and ML-DSA rest on lattice problems, which are in NP. If P = NP, one-way functions can’t exist, so lattice schemes, hashes and HMAC would all be breakable in principle.

Should I change anything now? Don’t swap algorithms in a panic. Do inventory where RSA, ECDSA and HMAC live in your stack, enforce an algorithm allowlist, add tests that reject alg: none and expired tokens, and make sure you can rotate keys in one deploy.

What’s the difference between this and the quantum threat? Shor’s algorithm on a large enough quantum computer would break RSA and elliptic curves. It only weakens hashes and HMAC slightly, and lattice schemes are designed to resist it. That’s why NIST’s post-quantum standards exist. P = NP would be broader: a classical algorithm that reaches every scheme, post-quantum ones included.

Would P ≠ NP prove my encryption is safe? No. Cryptography needs specific problems to be hard on typical inputs. P ≠ NP only says some problems are hard in the worst case.

Explore more

Versine MCP: What It Is and How AI Agents Send Money Safely

Versine MCP: What It Is and How AI Agents Send Money Safely

Versine MCP lets Claude and ChatGPT pay people from a USDC wallet, with a passkey on every payment by default. See its tools, limits, and how to test it with a mock first.

27 November 2026

Cloudflare Email Service API: How to Send Email from Workers (REST, Binding, SMTP)

Cloudflare Email Service API: How to Send Email from Workers (REST, Binding, SMTP)

Set up Cloudflare Email Service, then send email from a Worker binding, the REST API or SMTP, track delivery events and test the send endpoint with your coding agent.

26 November 2026

1Password Breach: What It Teaches About API Tokens

1Password Breach: What It Teaches About API Tokens

What did the 1Password breach expose? Learn what stayed safe and how to test your own API for recovery token expiry, single use and rate limits.

26 November 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

What Happens If P = NP? What It Would Mean for API Security