Password Hashing

In SQLPage, you can use the sqlpage.hash_password function to create a sequence of letters and numbers that can be used to verify a password, but cannot be used to recover the password itself. This is called a hash of the password, and it is a common way to store passwords in a database. This way, even if someone gains access to the database, they cannot recover the passwords.

They could still try to guess the passwords, but since SQLPage uses the argon2 algorithm, it would take a very long time (hundreds of years) to guess a strong password.

The sqlpage.hash_password function takes a password as input, and returns a hash of the password as output. It takes some time (a few hundred milliseconds) to compute the hash, so you should only call it when the user is creating a new account and on the initial login. You should not call it on every page load.

When you have logged in an user using the authentication component, you can store their session identifier on their browser using the cookie component.

Example

Try it out

You can try the password hashing function out by entering a password below and clicking "Hash Password".