(* A password-hash adapter for tests. It is real bcrypt at the minimum work factor, so it exercises the same code path as production without paying the production cost on every registration and sign-in in the suite. The production adapter, {!Hito_persistence.Bcrypt_hash}, pins a high cost and has its own unit tests. *) let cost = 4 let hash password = Bcrypt.string_of_hash (Bcrypt.hash ~count:cost password) let verify ~hash password = match Bcrypt.verify password (Bcrypt.hash_of_string hash) with | verified -> verified | exception _ -> false