When I was an undergraduate at Harvard, an astronomer from Berkeley came over to the physics building to give a talk. His name was Cliff Stoll, and he didn’t give a talk about astronomy. He gave a talk about accounting.

I remember the details less than Stoll’s frizzy Eurofro and his jumping around the front of the lecture hall as if he were on something Miley Cyrus might like to try.

For some reason, this astronomer worked on computers, and one day he noticed a seventy-five-cent accounting error, a phone bill discrepancy or something like that.

Normally someone who is only interested in estimating the age of the universe up to a few billion years ought not be so concerned with a seventy-five-cent error, but Stoll did care.

It led him to a German KGB spy ring paid in cocaine.

But that’s his saga. My point is that once Stoll figured out that spies were slipping into his computer system, he laid a trap. A file called, “Star Wars,” referring to the Strategic Defense Initiative.

The “Star Wars” file was big but it was fake. It contained nothing valuable. Maybe a recipe for really excellent-tasting cherry bakewells or something like that but that’s all. It was sweet enough to entice the spies, and large enough to keep them on the system long enough for Stoll to trace them. Gotcha.

Apropos of something, what’s surprising about the U.S. State Department/WikiLeaks scandal is that there is a scandal. As a friend reminded me, these days it’s really quite easy to make sure no one can read your messages, unless you want them to.

The science of cryptography has been around for ages. One of the simplest codes was used by Caesar. He would send secrets simply by shifting the letters of the message a few notches down the alphabet: “Mw xlex e hekkiv sv evi csy nywx lettc xs wii qi?” (Ouch!) I should point out that this kind of code is easy to break, since an interceptor can do some statistical analysis and figure out how many letters you have shifted down the alphabet by comparing the most common letter in your message with the letters that appear most frequently in your language. I should perhaps further point out that this code is easy to break if you’re not a Gallic barbarian. They did not have good schools.

In the Second World War, the Germans developed a device that, they felt, produced an unbreakable code: the ENIGMA machine. It resembled a typewriter, with a series of gears and wheels that produced a different letter each time you typed the same key.

And if by chance the Allies figured out this more complicated version of the Caesar shift, the next day the Germans could reset the settings and the Allies would have to figure the code out again starting from scratch.

The problem was that Germans may be efficient when it comes to tram schedules, but not so much when it comes to resetting ENIGMA machines. The Allies, led by the likes of Cambridge mathematician Alan Turing and with the help of Polish codebreakers, used high-speed, electronic computers that could work just fast enough to figure out ENIGMA’s “unbreakable” code.

It would seem there is no unbreakable code. For every scheme, you just build a faster computer to crack it, right?

Not necessarily. It’s possible that there may be a theoretical limit to how quickly you can perform certain tasks, called “NP-complete problems”―the “N” standing for “non-deterministic Turing machine”―that you would need to be able to perform quickly if you wanted to break codes in less time than it would take monkeys to type Hamlet. If so, and we think it’s so, all you’d need to do to keep third parties from reading your messages is to take two really, really big prime numbers―say, with 200 digits each―and multiply them together. It’s okay to use calculators.

The method is called “public key cryptography.” It’s really all the rage, and I’d be a bit surprised if U.S. Secretary of State Hillary Clinton, whose cables have been leaking out, didn’t know about it. The people up the road at the N.S.A. certainly do.

The National Security Agency is a riddle wrapped in a mystery inside a code. It dwarfs the C.I.A. And, most disturbing of all, it is the world’s largest employer of mathematicians. And they’re really, really good at multiplying.

Jonathan David Farley

A version of this article appeared in The Guardian (UK).