Could a hard drive actually have been erased as described in Cryptonomicon? In chapter 80, The Primary, Neal Stephenson has one of his character describe how the drives of a computer carried through a door (by the police, who where raiding the facility) will have been erased.
Basically, there's an enormous electromagnet around the door frame:

Cantrell is now drawing an elaborate diagram, and has even slowed down, almost to a stop, the better to draw it. It begins with a tall rectangle. Set within that is a parallelogram, the same size, but skewed a little bit downwards, and with a little circle drawn in the middle of one edge. Randy realizes he’s looking at a perspective view of a door-frame with its door hanging slightly ajar, the little circle being its knob. STEEL FRAME, Cantrell writes, hollow metal channels. Quick meandering scribbles suggest the matrix of wall surrounding it, and the floor underneath. Where the uprights of the doorframe are planted in the floor, Cantrell draws small, carefully foreshortened circles. Holes in the floor. Then he encircles the doorframe in a continuous hoop, beginning at one of those circles and climbing up one side of the doorframe, across the top, down the other side, through the other hole in the floor, and then horizontally beneath the door, then up through the first hole again, completing the loop. He draws one or two careful iterations of this and then numerous sloppy ones until the whole thing is surrounded in a vague, elongated tornado. Many turns of fine wire. Finally he draws two leads away from this huge door-sized coil and connects them to a sandwich of alternating long and short horizontal lines, which Randy recognizes as the symbol for a battery. The diagram is completed with a huge arrow drawn vigorously through the center of the doorway, like an airborne battering ram, labeled B which means a magnetic field. Ordo computer room door.  
"Wow," Randy says. Cantrell has drawn a classic elementary-school electromagnet, the kind of thing young Randy made by winding a wire around a nail and hooking it up to a lantern battery. Except that this one is wound around the outside of a doorframe and, Randy guesses, hidden inside the walls and beneath the floor so that no one would know it was there unless they tore the building apart. Magnetic fields are the styli of the modern world, they are what writes bits onto disks, or wipes them away. The read/write heads of Tombstone’s hard drive are exactly the same thing, but a lot smaller. If they are fine-pointed draftsman’s pens, then what Cantrell’s drawn here is a firehose spraying India ink. It probably would have no effect on a disk drive that was a few meters away from it, but anything that was actually carried through that doorway would be wiped clean. Between the pulse-gun fired into the building from outside (destroying every chip within range) and this doorframe hack (losing every bit on every disk) the Ordo raid must have been purely a scrap-hauling run for whoever organized it – Andrew Loeb or (according to the Secret Admirers) Attorney General Comstock’s sinister Fed forces who were using Andy as a cat’s paw. The only thing that would have made it through that doorway intact would have been information stored on CD-ROM or other nonmagnetic media, and Tombstone had none of that.

Would this actually work?
 A: Yes.
It is definitely possible to erase a hard drive with a strong enough magnetic field. Machines called "degaussers" exist only to erase hard drives in this manner, specifically without removing the drive platters (disks) from an enclosure.
Most degaussers appear to be rated at 8000-10000 Gauss. At the top end, then, degausser can produce a flux density (AKA field strength) of 1 Tesla - or about the same as in a loudspeaker (thanks, Wikipedia!). By comparison, this averages to about half that of typical MRI scanners.
So, yes it would be possible. The possible side-effects in the vicinity might be interesting, it may be that it would have been obvious to the officers raiding the building.
A: There's really two parts to your question, which I'm going to answer separately.  First of all, the explicit question:
Could a huge electromagnetic coil erase a hard drive carried through it?
Sure it could.  That's pretty much what a degausser does, and these things are routinely used to erase magnetic media, including hard drives.
OK, with that out of the way, let's move on to the implied question:
Could you actually do that, without the person carrying the drive noticing?
Based on some quick research, my conclusion is: no way in hell.
To quickly and reliably degauss a hard drive, you apparently need a magnetic field strength on the order of 15,000 Gauss (= 1.5 Tesla).  Even if we assume that the Ordo hard drives were old and maybe specifically selected for low coercivity, we're still talking several thousand Gauss at least.
For comparison, the field strength inside a typical MRI scanner is also around 1.5 Tesla, while the field at the surface of a modern neodymium–iron–boron (Nd2Fe14B) rare earth magnet — basically, the strongest permanent magnet you can get — is around 1.25 Tesla.
Thus, someone walking through Stephenson's "degausser door" with a bunch of hard drives would experience something similar as if they tried carrying them through an MRI coil — or holding them while standing right next to a humongous door-sized Nd2Fe14B magnet slab.
Now, if you've ever played with neodymium magnets, you'll know that even tiny ones are damn hard to pry off any ferromagnetic objects they touch.  To quote the Wikipedia page I linked to above:

"Neodymium magnets larger than a few cubic centimeters are strong enough to cause injuries to body parts pinched between two magnets, or a magnet and a metal surface, even causing broken bones."

As for MRI scanners, there's a reason why the first and last thing they check, when you go and have an MRI scan, is that you have nothing potentially ferromagnetic on or in your body.  The reason is that anything ferromagnetic that gets too close to an active MRI magnet is likely the get torn off your hands and violently slammed against the magnet.  This has been known to happen to pretty much any wholly or partially ferromagnetic object you'd care to imagine, from wheelchairs, office chairs and floor polishers to scissors, oxygen bottles (which killed a small child) and even pistols (which, yes, went off when it hit the scanner).
So, let's imagine what'll happen to your hapless policeman, as he's walking towards the magnetized door carrying a stack of hard drives.  The first thing he's likely to notice, while still several meters away, is that something's pulling at the drives he's carrying (since they have a lot of ferromagnetic metal in the casing, and even some pretty strong magnets inside).  If he's not careful, the drives might slip out of his hands and fly through the air towards the door, slamming against the door jamb with enormous force (and, yes, likely getting pretty well wiped in the process).
The next thing he might notice, if that's not enough to make him stay well away from the door, is that the same force is also tugging at his badge, gun, zipper, belt buckle, the screwdriver in his pocket that he used to open the servers and extract the hard drives, and anything else metallic that he might have on him.  If he's not careful, and keeps approaching the door, those items might either get pulled out of his pockets, or they might simply get drawn to the door and pull him along with them.  If he's lucky, the only thing getting pinched between the door and the objects is his clothing.  If he's not... 
Of course, that's all assuming that, when the magnet turned on, it didn't immediately turn any nearby chairs, tables, computer equipment and miscellaneous office supplies into flying missiles, with potentially lethal consequences to anyone standing between such an object and the door.  Or that the intense magnetic field didn't simply mess up the unlucky officer's pacemaker, as it would surely do to any cell phones or other electronic equipment they might be carrying.
A: In Theory...but Not In Reality
It's one of those ideas that is possible in theory but impractical in practice.
Hard drives in computers are surrounded by a metal case of the drive, then the metal case of the computer. Even if you specifically got a non-metal case there is still some shielding there.
To generate a magnetic field strong enough to reliably have the effect of wiping all the data at the range you need to wipe it at you would also affect other things - such as for example the metal on clothing/equipment of the people going into and out of the room and the metal in the computer itself.
People would notice their police badge flying off long before they tried taking a computer through the door.
If you want to self destruct your data then applying something directly to the drive is a much easier way to do it, although with modern forensic techniques even that requires a certain amount of care and attention.
Note that causing some corruption to the drives is much easier than wiping them. Destroying a few sectors might cause your computer to stop working but a lot of the data on that drive will still be readable.
A: Possibly.
Degaussing is the process of destroying data on a hard drive using an electromagnetic field, so there's some scientific basis to the idea. Assuming the electromagnet was sufficiently strong and there was no or very little shielding around the hard drive - which, if you were building a large electromagnet around a doorway specifically for this purpose, you could make sure was the case - then it could in theory be used to destroy a standard hard disk drive.
There'd be no guarantee that all of the data would be destroyed, the drive would almost certainly be unusable afterwards, and you couldn't ever switch to solid state drives.
A: Agree with all comments above about the required strength, and the likely side effects if it were a DC degausser.  But I got to thinking - if it were an AC degausser instead, you'd have lots of  erasure events per second.  Plus, you'd get metal objects wiggling back and forth instead of being yanked around.  Do it at a pretty high frequency, and you'd be able to make a short pulse. Maybe short enough to not be noticed. But the timing would be important. Probably there'd be a loud humming, and maybe even sparks!
A: I agree that some hard drives could be "erased" with the described electromagnet. However, if the hard drive is "magnetically shielded," then it is highly unlikely.  If a "high enough" (> 50,000 hertz) frequency is used, the presence of the electromagnet should not be "humanly" detectable.
