Helper Functions#

Sync Functions:#

quart_bcrypt.generate_password_hash(password, rounds=None) bytes#

This helper function wraps the eponymous method of Bcrypt. It is intended to be used as a helper function at the expense of the configuration variable provided when passing back the app object. In other words this shortcut does not make use of the app object at all.

To use this function, simply import it from the module and use it in a similar fashion as the original method would be used. Here is a quick example:

from quart_bcrypt import generate_password_hash
pw_hash = generate_password_hash('hunter2', 10)
Parameters
  • password – The password to be hashed.

  • rounds – The optional number of rounds.

quart_bcrypt.check_password_hash(pw_hash: bytes, password: str) bool#

This helper function wraps the eponymous method of Bcrypt. It is intended to be used as a helper function at the expense of the configuration variable provided when passing back the app object. In other words this shortcut does not make use of the app object at all.

To use this function, simply import it from the module and use it in a similar fashion as the original method would be used. Here is a quick example:

from quart_bcrypt import check_password_hash
check_password_hash(pw_hash, 'hunter2') # returns True
Parameters
  • pw_hash – The hash to be compared against.

  • password – The password to compare.

Async Functions:#

async quart_bcrypt.async_generate_password_hash(password: str, rounds: Optional[int] = None) bytes#

This async helper function wraps the eponymous method of Bcrypt. It is intended to be used as a helper function at the expense of the configuration variable provided when passing back the app object. In other words this shortcut does not make use of the app object at all.

To use this function, simply import it from the module and use it in a similar fashion as the original method would be used. Here is a quick example:

from quart_bcrypt import async_generate_password_hash
pw_hash = await generate_password_hash('hunter2', 10)
Parameters
  • password – The password to be hashed.

  • rounds – The optional number of rounds.

async quart_bcrypt.async_check_password_hash(pw_hash: bytes, password: str) bool#

This async helper function wraps the eponymous method of Bcrypt. It is intended to be used as a helper function at the expense of the configuration variable provided when passing back the app object. In other words this shortcut does not make use of the app object at all.

To use this function, simply import it from the module and use it in a similar fashion as the original method would be used. Here is a quick example:

from quart_bcrypt import async_check_password_hash
await async_check_password_hash(pw_hash, 'hunter2') # returns True
Parameters
  • pw_hash – The hash to be compared against.

  • password – The password to compare.