package passe
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=67b052af6a84859dfcc13438e6109062d18a9184527c5c9a5f5b1b65cc3800be
sha512=c3bfb4d4c9f47df53c904fadcf6ff6de4480885244f61948bfe2025998bcfc3091c353f5a4bc79f7f96c42d874ef2743045a56f26719992104d03fa51c770c79
Description
Passe is library for hashing and verifying passwords using bcrypt and argon2 algorithms. It is designed to be simple, secure, and easy to use in OCaml applications
Added to opam-repository:
README
Passe - Password hash algorithm
Passe is an OCaml library for hashing and verifying passwords using Bcrypt and Argon2.
The primary goal of Passe is to provide a simple and secure interface for password hashing, and easy to install library. All dependencies are vendored, so no external libraries are required.
Usage
Argon2
let hash_result = Passe.Argon2.hash "my_password"
match hash_result with
| Ok hash ->
(* Store the hash in your database *)
let hash_string = Passe.hash_to_string hash in
store_in_db hash_string
| Error e ->
Format.eprintf "%a" Passe.Argon2.pp_error e
(* Verify a password against a stored hash *)
let stored_hash = Passe.hash_of_string (get_from_db ()) in
match Passe.Argon2.verify ~hash:stored_hash "user_input" with
| Ok true -> (* Password matches *)
| Ok false -> (* Password does not match *)
| Error e -> (* Handle error *)
(* Use custom parameters *)
let params = { Passe.Argon2.t_cost = 3; m_cost = 65536; parallelism = 4 } in
let hash_result = Passe.Argon2.hash ~params "my_password"Bcrypt
let hash_result = Passe.Bcrypt.hash "my_password"
match hash_result with
| Ok hash ->
let hash_string = Passe.hash_to_string hash in
store_in_db hash_string
| Error e ->
Format.eprintf "%a" Passe.Bcrypt.pp_error e
let stored_hash = Passe.hash_of_string (get_from_db ()) in
match Passe.Bcrypt.verify ~hash:stored_hash "user_input" with
| Ok true -> (* Password matches *)
| Ok false -> (* Password does not match *)
| Error e -> (* Handle error *)
(* Use custom cost factor *)
let hash_result = Bcrypt.hash ~cost:14 "my_password"Examples
The examples/ directory contains cross-language verification tests that demonstrate compatibility with Python's argon2-cffi and bcrypt libraries.
License
This library is licensed under the ISC License. See LICENSE for details.
Third-Party Code
This library includes vendored implementations:
- Argon2 reference implementation (dual-licensed CC0 1.0 Universal / Apache 2.0)
- Bcrypt from OpenBSD (ISC License)
- Blowfish cipher from OpenBSD (BSD 4-Clause License)
All third-party licenses and attributions are included in the LICENSE file.
Dependencies (4)
-
mirage-crypto-rng
>= "1.2.0" - mirage-crypto
-
dune
>= "3.19" -
ocaml
>= "4.14"
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building passe with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.2.0 (this version) | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure