A lock is a mechanical or electronic fastening device that is released by a physical object (such as a key, keycard, fingerprint, RFID card, security token etc.), by supplying secret information (such as a keycode or password), or by a combination thereof.
The earliest known lock and key device was discovered in the ruins of Nineveh, the capital of ancient Assyria. Locks such as this were later developed into the Egyptian wooden pin lock, which consisted of a bolt, door fixture, and key. When the key was inserted, pins within the fixture were lifted out of drilled holes within the bolt, allowing it to move. When the key was removed, the pins fell part-way into the bolt, preventing movement.
The warded lock was also present from antiquity and remains the most recognizable lock and key design in the Western world. The first all-metal locks appeared between the years 870 and 900, and are attributed to the English craftsmen. It is also said that the key was invented by Theodore of Samos in the 6th century BC.
Affluent Romans often kept their valuables in secure boxes within their households, and wore the keys as rings on their fingers. The practice had two benefits: It kept the key handy at all times, while signaling that the wearer was wealthy and important enough to have money and jewelry worth securing.
With the onset of the Industrial Revolution in the late 18th century and the concomitant development of precision engineering and component standardisation, locks and keys were manufactured with increasing complexity and sophistication.
The lever tumbler lock, which uses a set of levers to prevent the bolt from moving in the lock, was perfected by Robert Barron in 1778. His double acting lever lock required the lever to be lifted to a certain height by having a slot cut in the lever, so lifting the lever too far was as bad as not lifting the lever far enough. This type of lock is still currently used today.