Most combination locks use a wheel pack; a set of wheels that work together to 'know' the combination. All wheel packs are all designed around the same principle.
The typical combination lock has a combination dial that is attached to a spindle. Inside the lock, the spindle runs through several wheels and a drive cam.
The number of wheels in a wheel pack is determined by how many numbers are in the combination - one wheel for each number. When you turn the dial, the spindle turns the drive cam. Attached to the drive cam is a drive pin. As the cam turns, the drive pin eventually makes contact with a small tab on the adjacent wheel called the wheel fly.
Each wheel has a wheel fly on each of its sides. The drive pin spins the first wheel until it makes contact with the wheel adjacent to it. This continues until all the wheels are spinning. This is known as picking up the wheels. Each wheel on the spindle has a notch cut into it. When the right combination is dialed, all the wheels and their notches line up perfectly.
The fence is a small metal bar attached to a lever. The fence prevents the safe door from being opened without the combination being dialed. It does this by resting on the wheels and blocking the path of the bolt that secures the safe door.
When all the wheels line up, their notches align to form a gap. In a padlock, this gap allows the hasp of the lock to release. In a safe, there is a piece called the fence resting just above the wheels. The fence falls into this gap under the force of its own weight. With the fence gone, the bolt can slide freely past and the safe can be opened.
The wheel pack design has been used for almost 100 years.