A lock is a mechanical or electronic fastening device that is released by a physical object, by supplying secret information, by a combination thereof, or it may only be able to be opened from one side, such as a door chain.
A typical modern padlock and its keys
Bronze lock in a form of scorpion from Nalanda, India, 10th century.
Medieval Gothic lock, from the 15th–16th centuries, made of iron, in the Metropolitan Museum of Art (New York City)
Drunk man's lock at the bottom (black lock) and a regular modern lock at the top
A keycard lock is a lock operated by a keycard, a flat, rectangular plastic card. The card typically, but not always, has identical dimensions to that of a credit card, that is ID-1 format. The card stores a physical or digital pattern that the door mechanism accepts before disengaging the lock.
A mechanical keycard, with "bumps" that operate pins inside of the lock (similar to a pin tumbler lock)
A keycard with a magnetic stripe
A hotel entry card used to enable a light switch
Illustrated instructions for use of mag stripe key card