
Locks and keys
by Chris Woodford. Last updated: May 13, 2011.
Dangerous criminals, gold bars, glittering jewels—what do they have in common? All are kept secure by locks and keys. Would the world be a happier place if no-one had invented such things? It just might be! Imagine it for a moment. Anyone could steal anything, so perhaps no-one would bother owning very much or wanting anything more. No-one would live in a fancy house with valuable belongings, swan around in a luxury car, or earn more money than they could carry in their pocket. Perhaps that would be a better world, but it's not the one we live in! In our materialist modern age, we buy stuff, earn money, and buy even more stuff. We are what we own—and the only thing standing between a lifetime of slowly accumulated, valuable possessions and instant poverty is the lock on the door. Locks, then, are pretty important things, but have you ever stopped to wonder how they work? Let's take a closer look!
Photo: A secure padlock like this has a cylinder, pin-tumbler lock inside it. The hardened metal loop at the top is designed to stop you sawing through it.
What is a lock?

In the very broadest sense of the word, a lock is a device that keeps valuables safe or restricts access to something that needs protecting. A lock can hold things out (protecting homes from intruders and banks from thieves) or keep them in (holding criminals in jail or animals in zoos). Before the modern electronic age, locks were entirely mechanical and based on intricate mechanisms made from levers, wheels, gears, and cams. During the mid-20th century, locks became more sophisticated and automated and started to incorporate electrical and electronic mechanisms. But now information is valuable too and most of it is held inside hundreds of millions of computers that are all linked together through the Internet. Modern locks that protect computers are based on encryption—a way of securing information using complex mathematical processes.
How do locks work?
Most mechanical locks are fitted to things like doors and cupboards and have two physically separate parts. One part is fitted to the frame (the static part of the door) and is essentially a sturdy, metal reinforcement for a hole cut into the door itself (to prevent the locked door from being opened with brute force). The other part of the lock fits into a rectangular hole in the door (known as a mortise) and consists of a metal mechanism that moves a heavy bolt into or out from the reinforced hole. The bolt (sometimes called a deadbolt) slides from side to side when you turn a key clockwise or anticlockwise, so it has to be operated by a mechanism that can convert rotary motion (the turning key) into reciprocating motion (the sliding bolt)—something like a cam or crank. If that were all that a lock consisted of, every key would be able to open every lock. So the other essential part of a lock's mechanism is a set of fixed or moving metal pieces (wards or tumblers) that engage with slots cut into the key, ensuring only one key can rotate, turn the cam, slide the bolt, and open the door.
Types of locks
There are several different types of locks and they all work in a slightly different way. Ward locks are the oldest and simplest. From the outside, they look like any other lock. Inside, they they have curved, jutting out pieces of metal fitted inside them (called wards) that exactly line up with the holes in a particular key. Other keys can be inserted into the lock but the wards will stop them from turning. Since they're relatively crude and fairly easy to pick, ward locks are no longer in common use, except for very low security applications.
Tumbler locks are a more recent (19th-century), more sophisticated, and much more secure design—best known to most of us in the form of the cylindrical pin tumbler or Yale lock (invented by Linus Yale, Jr. in the 1860s). All kinds of variations on this basic design exist; if you search the US Patent and Trademark Office database for "cylinder lock," you'll find well over 500 different ones! Padlocks operated by keys are essentially portable, miniaturized Yale locks with super-small cylinders and pin tumblers. Read more about Yale locks in the box down below.

Electronic locks do away with metal keys altogether; you've almost certainly use one if you've stayed in a hotel recently. Instead of a key, you have a plastic card (similar to a credit card) that has a magnetic strip on the back. When you slide the card into the lock, an electronic reader circuit decodes the information on the strip and checks for a match with a code stored inside it. If it's the right key, the circuit activates a powerful electromagnet that pulls a bolt sideways, allowing you to open the door.
With traditional mechanical and electronic locks, there's still one basic security flaw: if someone else has your key, they can open your lock and steal your things. That's why the latest forms of security incorporate biometric locks (featuring things like fingerprint readers or iris scanners) that grant access to a specific person rather than just any old person who happens to have the matching key. Sooner or later, sometime in the future, almost every lock we encounter will have some form of biometric security checking built in.
If you're using a computer, a password (or passphrase) is the equivalent of a key granting you access to a particular machine, network, website, or whatever it might be. Just as a key can be stolen, so can a password—but the added problem with passwords is that they can be guessed (or different ones can be tried again and again until the right one finally works). That's why really secure computer systems (such as online banking systems) are now using a kind of enhanced security called two-factor authentication: to gain access, you have to know one or more passwords and possess a physical device (called a token) that generates a one-off (disposable) security code you enter as a kind of extra password. Read more in our article on security tokens.
Photo: Electronic key: Some banks are now giving two-factor authentication devices like this to their customers. When you put your credit or debit card into it, it generates a number that you type into a banking or shopping website to use as a kind of one-off, disposable passwords. So it's a bit like an electronic key that opens an online lock.





