The use of locks goes back to the beginning of recorded history. Men have have always been concerned with protecting their property from others.
Locks are how people have have protected their property.
The oldest example of a mechanically lock was found among the ruins of the palace of Khorasabad in Niveveh. This lock has come to be known as an Egyptian door lock, because of it's widespread use in Egypt. This lock is a forerunner of modern pin-tumblers. The lock consisted of a vertical wooden housing containing several loose wood en pegs of different lengths. These pegs fitted into holes bored in the top of a wooden bolt, preventing the bolt from being moved and the door from being opened.