In the most common type of lock (the pin tumbler lock),
as you push the key in, the teeth of the lock slide
underneath the pins, inevitably resulting in wear of both
the key's teeth and the lock's pins.
This idea prevents that, and also prevents lock bumping,
and should also make the lock
much more pick resistant.
Above the entrance to the keyhole, there's a wheel.
There are several cylindrical holes bored through this
wheel, with a pin in each cylinder; these are arranged
radially. All of the pins in the lock are the same length
as each other, and each pin is a single piece. In
between uses, each pin is in the outward-most position
in it's cylinder. Friction keeps each pin in it's proper
position.
As the key is pushed into the keyhole, the wheel turns,
pushing each pin against the key tooth that is passing
underneath. The pins remain in their new positions
after the teeth have passed, again due to friction.
When the key is entirely in the lock, the user tries to
turn it; this pushes the wheel sideways (without turning
the wheel), through an opening that will only pass the
wheel if every pin is pushed in the correct amount.
Pins that aren't in enough will of course meet the
outside edge of the hole; for pins that were pushed too
far inward, their tops meet an obstruction which passes
through the inside of the wheel.
If the wheel can pass through the opening, it pushes on
a lever which engages or disengages the locking bolt.
Locks are keyed differently from one another by varying
the shape of the opening through which the wheel must
move.
A mechanism is required to make sure the wheel is
turned at the same rate as the key is pushed in, and
another mechanism is required to make sure that the
pins are reset between uses.
Both of these needs can be accomplished by having the
tip of the key push against a lever, which
simultaneously turns the pin wheel, and compresses a
spring.
As the key is removed from the lock, the spring pushes
on the lever, and turns the pin wheel backwards. For
each pin, just after it moves past the key tooth that
had pushed it inwards, either it gets pushed outwards
due to the "top" (inner surface) sliding across a ramp, or
pulled outwards by an appropriately located permanent
magnet.
The impossibility of bumping should be obvious.
Pick resistance is provided by the fact that the lock
effectively measures the height of every key tooth
first, and then, separately, tests all of these
measurements simultaneously. This should eliminate
most of the tactile or auditory feedback that a lock pick
might expect to use to determine which pins he has
guessed the correct heights of.
Pick resistance can be truly maximized if the lock can
only be turned if the key is fully inserted, and if the pins
are only reset when the key is fully removed -- this
would require a slightly more complicated mechanism,
but it shouldn't be particularly difficult.