How do the locks work?

A lock is a device used for raising and lowering boats, ships and other watercraft between stretches of water of different levels on river and canal waterways. Locks are used to make a river more easily navigable, or to allow a canal to cross land that is not level.

Beside this, what is the padlock on websites?

What does the padlock at the bottom of some websites mean? You have noticed a padlock icon at the bottom of certain web pages. It indicates that the page uses the SSL protocol (a data transfer security standard that encrypts data and authenticates the server and the integrity of the message) or the TLS protocol.