SECRETS, AS WE ALL LEARNED AS KIDS, ARE seductive, dangerous, essential. Secrecy cements friendships, wins wars, makes money, starts revolutions, nurtures romances. Though it's perhaps not polite to acknowledge it in our age of openness and sharing, secrets drive the world.

This has never been more true than it is today. As our economy moves from a bunch of people making stuff to a bunch of people thinking stuff, intellectual property is the key to riches and power--if we can keep it secret. Secrets, now, are the lifeblood of commerce. And the science of secrets is cryptography.

So if you know Seattle writer Neal Stephenson, it will come as absolutely no surprise to you that his latest book, Cryptonomicon, is essentially a 900-page gedankenexperiment about cryptography. Stephenson, after all, is one of a handful of science fiction writers (Bruce Sterling, William Gibson, David Brin, and Kim Stanley Robinson also come to mind) who use sci-fi to, in Sterling's words, "predict the present." While their books may involve fantastic technologies or the colonization of Mars, their subject is really the changes we're living amidst.

Stephenson showed he was good at this with his first novel, Zodiac, an "ecothriller" about a Greenpeace-like environmentalist trailing a dangerous polluter through scientific detective work. Snowcrash, his next and most famous work, sketched his vision of virtual reality, one where we all tool around in cyberspace as electronic avatars, hanging out in virtual bars in virtual cities. This has proved compelling to many people for reasons I do not understand.

His last work, The Diamond Age, or, A Young Lady's Illustrated Primer, though, is probably the best science fiction book written this decade. In Diamond Age, nanotechnology--tiny engines able to rearrange matter (a trick some very brilliant people insist is quite possible)--has become commonplace, destroying economies and nations and leaving people adrift in an overpopulated, polluted world of tribe-like corporate "phyles."

Diamond Age centers around little Nell, a child living in a Dickensian future Shanghai, and her discovery of a magically technological primer, one that makes today's ideas of "interactive learning" look like red ochre smeared on cave rock in the vague outline of a wildebeest. Thus the book becomes in part a sort of paperback Emile, a fictional discourse on the nature of education and freedom. But Nell is growing up in a world where technological change has rocked societies off their foundations. People are veering off into neo-pagan anarchy (or just plain thuggery), or retreating into deep traditionalism, reviving Victorian mores or Confucian legal systems. So Diamond Age has a rich subtext: What do people do when technology undermines their moral systems? This is not a trivial question.

The central question Cryptonomicon poses is not trivial, either. For the real theme in Cryptonomicon is freedom, and how, paradoxically, secrecy may be necessary to maintain it.

Randall Lawrence Waterhouse, the book's hero, first learns he's getting mixed up in something big when his business partner Avi asks him to construct an extravagantly complex encryption code for their messages to one another. Since advances in computing power dictate that most approaches to encryption become obsolete over time, Randy asks Avi how long he wants these messages to remain secret. Avi replies, "I want them to remain secret as long as men are capable of evil."

This, in narrative terms, is the moment when the guardrail on the roller coaster car swings down, and--thunk!--locks into position.

Before we know it, Stephenson has us careening through time and space: the battle of Guadalcanal, Catholic secret societies, codebooks and punchcards and vacuum tubes, the paranoia of U-boat submariners hunted across a hostile ocean, Van Eck phreaking, Internet billionaires and postmodern academics, Tokyo's Akihabara electronics bazaar, pipe organs, the odd and very gray island of Outer Qwghlm.

For what Randy has stumbled into is a plan to build a Data Haven--think of it as a Swiss bank for sensitive information--in a fictionalized version of Brunei. But then, he's also involved with his friend Avi's plan to prevent future Holocausts by disseminating plans for homemade guns and guerrilla warfare to minority peoples worldwide.

Then, too, there are the wartime escapades of Randy's grandfather Lawrence Waterhouse, who is a cryptography prodigy: one who becomes so good at breaking Nazi codes that the challenge becomes not how to break the new codes, but how to keep the Axis leaders from knowing their codes are broken. So we also get to meet a special forces group, whose sole task is to go out and let the Germans capture disinformation, which explains things like, oh, why all their U-boats keep getting sunk.

And then there's the buried gold. In the waning days of World War II, an improbable cabal (consisting of a U.S. Marine sergeant, a gay Nazi mathematician, a defrocked Catholic priest, a U-boat captain, and a Finnish coffee smuggler) plots to get its hands on an enormous cache of gold stolen by the Japanese and secreted in the Philippine jungle--a lot of gold, hundreds of billions of dollars worth, as it turns out--enough to destabilize governments or end global poverty. As you might imagine, this raises the stakes.

Throughout it all run the codes. In many ways, Cryptonomicon is a theme-and-variation piece on the uses and value of secrecy. Stephenson seems to be telling us that in our age, secrecy is too important to be left in the hands of government. Death camps, germ warfare, mass rape, and ethnic cleansing, usually at the hands of government troops, have defined our century. Our only real hope, Stephenson suggests, lies in people who use technology and secrecy to thwart bad government and promote good--something like a 21st-century version of the Freemasons, I guess. Whether this is a good idea, I'll let others judge.

Ultimately, though it has its moments, Cryptonomicon is not a brilliant book. For one thing, it's got a 200-page beer belly: long passages of no importance, windy technical descriptions of different encryption methods, little subplots that go winging off into nowhere. For another, not one female character is three-dimensional. Stephenson really could have used a tough editing workout, a word diet, and someone to smack him upside the head on occasion, because there are flashes of brilliance. Stephenson is both funny and insightful when he writes about the global economy. And when he actually lets the cryptography run through the story--instead of stopping to explain it to us--his writing tears across the page like a rocket car on a salt flat. Stephenson, like all great science fiction writers, is best when he's explaining the present by telling us what the future's going to feel like.

That's what made Diamond Age such a brilliant book. But Cryptonomicon's flaws ultimately leave us wondering if something didn't get lost in transmission.