Skip to content

What Happens If P = NP?

Published:

P vs NP asks one question: if a computer can check an answer quickly, can it also find that answer quickly? Most people believe the answer is no (P ≠ NP). Nobody has proved it, and a lot of the internet’s security quietly depends on it being true.

I’d heard of P vs NP for years without really getting why anyone outside academia should care. Dan Hollick’s explainer, written amid rumours of a proof on the way, finally made it click for me:

Here’s how I understand it now.

P: easy to solve

A P problem can be solved in polynomial time. As the input grows, the work grows like n, n² or n³, which is predictable and manageable.

Looking up a name in a phone book is a good example. The book is sorted, so even a huge one is quick to search.

NP: easy to check

An NP problem is one where a proposed answer can be checked in polynomial time, even if finding it seems very hard.

Sudoku is the example that works for me. Solving a big puzzle is hard because there are so many possibilities to try. But if you hand me a filled grid, I can check every row, column and box quickly. Scale the grid to 1,000×1,000 and checking is still quick, while solving explodes.

Every P problem is also in NP: if you can solve it fast, you can check it fast. The open question is the other direction. Is every problem that’s easy to check also easy to solve, and we just haven’t found the clever method yet? That would be P = NP.

Why this matters to me as a developer

Encryption like RSA relies on a “one-way door”. Multiplying two huge primes is easy. Given only the product, finding those two primes is believed to be impractically slow. Your private key is built from the primes, and your public key from the product.

If P = NP, one-way functions wouldn’t exist. Checking a guess at the primes is easy, so finding them would be easy too. And it wouldn’t stop at RSA: almost every cryptographic scheme, post-quantum ones included, rests on some problem being easy to check and hard to solve.

Why we might be fine anyway

This was the part I found reassuring:

So the real risk to your keys isn’t the P vs NP proof itself. It’s someone finding a fast method for the specific problem your encryption depends on.

We live in interesting times. AI is helping us make progress on problems that have been stuck for decades, and it’s also challenging assumptions we’ve built everything on. Whichever way P vs NP goes, I’m excited to see what becomes possible next.

Is Your SSH Connection Post-Quantum?