package passe

  1. Overview
  2. Docs

Module Passe.BcryptSource

Sourcetype error = [
  1. | `Hash_failure
  2. | `Invalid_cost of string
  3. | `Invalid_hash of string
  4. | `Invalid_prefix of string
  5. | `Invalid_salt_length of int
  6. | `Salt_generation_failure
  7. | `Truncated of int
]
Sourceval pp_error : Format.formatter -> error -> unit

pp_error fmt err pretty print bcrypt error err to formatter fmt

Sourceval hash_with_salt : salt:string -> string -> (hash, error) result

hash_with_salt ~salt password hash the password using the given salt

Sourceval hash : ?cost:int -> string -> (hash, error) result

hash ?cost password hash the password using the given cost. If no cost is provided, a default cost of 12 is used.

Sourceval verify : hash:hash -> string -> (bool, error) result

verify ~hash password verify that the password matches the given hash