The part into which the key is pushed is a cylinder, able to revolve in a larger cylinder outside it, which is fixed. The key cylinder has an arm on the inner end which moves the bolt of the lock when the key is turned. In the key cylinder is a row of upright holes, which are opposite an equal number of holes in the outside cylinder when the key slot is vertical. There are pins of various lengths in the holes, and springs above the upper ones to push each pair downwards.
When a key is pushed into the lock it drives. the pins upwards. If the correct key is used, the top of every lower pin and the bottom of every upper pin will be flush with the joint between the two cylinders, and the key cylinder is free to turn. A wrong key will drive one or more pins up too far, or not far enough, so that the two cylinders are locked together, and it is impossible to turn the key.