7 | --------------------------------------------------------------------------------
8 | -- Salt generation
9 | --------------------------------------------------------------------------------
11 | ||| Generate a new bcrypt salt.
12 | |||
13 | ||| The supplied cost factor should typically be between 4 and 31 inclusive.
14 | |||
15 | ||| Common production values today are 10–14 depending on the desired computational cost.
16 | |||
17 | export
22 | --------------------------------------------------------------------------------
23 | -- Password hashing
24 | --------------------------------------------------------------------------------
26 | ||| Hash a password using a newly generated bcrypt salt.
27 | |||
28 | ||| The supplied cost factor determines the bcrypt work factor.
29 | |||
30 | export
35 | ||| Hash a password using an existing bcrypt salt or bcrypt hash.
36 | |||
37 | ||| This is useful when reproducing an existing hash or when deterministic hashing is desired for testing.
38 | |||
39 | export
44 | --------------------------------------------------------------------------------
45 | -- Password validation
46 | --------------------------------------------------------------------------------
48 | ||| Validate a password against a bcrypt hash.
49 | |||
50 | ||| Returns `True` when the supplied password matches the bcrypt hash and `False` otherwise.
51 | |||
52 | export