[OCaml] High Intensity Training Online
1
(* A password-hash adapter for tests. It is real bcrypt at the minimum work
2
factor, so it exercises the same code path as production without paying the
3
production cost on every registration and sign-in in the suite. The
4
production adapter, {!Hito_persistence.Bcrypt_hash}, pins a high cost and
5
has its own unit tests. *)
6
7
let cost = 4
8
let hash password = Bcrypt.string_of_hash (Bcrypt.hash ~count:cost password)
9
10
let verify ~hash password =
11
match Bcrypt.verify password (Bcrypt.hash_of_string hash) with
12
| verified -> verified
13
| exception _ -> false
14