Authentication Module

hedwig.auth

hedwig.auth.create_password_hash(password_raw)

Create hash and salt for the given raw password.

The password is encoded as UTF-8 and a salt read from “os.random”. Returns ASCII hex representation of the hash and salt.

hedwig.auth.check_password_hash(password_raw, password_hash, password_salt)

Checks the given raw password against the hash and salt.

Assumes that the hash and salt are given in ASCII hex representation and checks whether the password re-generates the hash when hashed using the salt.

hedwig.auth.generate_token(n=16)

Generate random token strings, to be used for things such as password reset codes and invitations.