For the music term, please see key (music)
A Key is a shaped piece of metal used to lock or unlock a lock. Typically a key for one lock will not work in any other lock, but a master key will open a series of locks that also have their own individual keys.
As an analogy, passwords and decryption codes for electronics are sometimes called keys. Although there is never an actual unique piece of metal, a unique code is used to protect devices or content. In some cases, a "keyfile" is also used, which is a data file stored on removable storage. This file will contain a long, usually gibberish code, which cannot be remembered by the user.
Keycards are another kind of modern key. Although their shape is not unique, they contain a magnetic strip or RFID chip which contains a unique code. These are used for a variety of purposes such as electronic door locks and computer security.
Some moderns keys also combine a traditional key with a keycard. These keys usually contain an RFID chip, so that the metal key must fit into the lock, and the chip must provide the correct security code. Cars keys are usually made this way. Some cars will not accept the key at all unless both requirements are met, but some will allow certain locks (such as door locks) to be released without the RFID chip. If this is the case, often the engine ignition will be the only part of the car which requires the digital code.