Idris2Doc : Crypto.BCrypt

Crypto.BCrypt

(source)

Definitions

genSalt : WorkFactor->IOString
  Generate a new bcrypt salt.

The supplied cost factor should typically be between 4 and 31 inclusive.

Common production values today are 10–14 depending on the desired computational cost.

Totality: total
Visibility: export
hashPassword : String->WorkFactor->IOString
  Hash a password using a newly generated bcrypt salt.

The supplied cost factor determines the bcrypt work factor.

Totality: total
Visibility: export
hashPasswordWithSalt : String->String->IOString
  Hash a password using an existing bcrypt salt or bcrypt hash.

This is useful when reproducing an existing hash or when deterministic hashing is desired for testing.

Totality: total
Visibility: export
validatePassword : String->String->IOBool
  Validate a password against a bcrypt hash.

Returns `True` when the supplied password matches the bcrypt hash and `False` otherwise.

Totality: total
Visibility: export