Hashing

Never save the password in plain text in the DB again. Use bcrypt for the encryption

Classes:

Hasher()

You can Hash and check a Hashed string with this class

class tools.hashing.Hasher[source]

You can Hash and check a Hashed string with this class

Methods:

get_password_hash(password)

Get a hashed value of a string

verify_password(plain_password, hashed_password)

Check if the password are the same.

static get_password_hash(password: str) str[source]

Get a hashed value of a string

Parameters

password (str) – Password to hash

Returns

Hashed value

Return type

str

static verify_password(plain_password: str, hashed_password: str) bool[source]

Check if the password are the same. Uses a safe way to verify to avoid hacks.

Parameters
  • plain_password (str) – Plain text password

  • hashed_password (str) – Hashed password from get_password_hash

Returns

true or fales if the password is the same

Return type

bool