pw_hash

Crates.iopw_hash
lib.rspw_hash
version0.1.1
sourcesrc
created_at2024-08-01 15:55:17.730872
updated_at2024-08-01 18:34:04.919609
descriptionA collection of password hashing routines in pure Rust. Fork of pwhash by inejge.
homepagehttps://github.com/NamesMark/pwhash
repositoryhttps://github.com/NamesMark/pwhash
max_upload_size
id1322175
size108,987
Mark (NamesMark)

documentation

https://docs.rs/pw_hash/latest/pw_hash/

README

pw_hash

A collection of password hashing and verification routines.

This is a fork of the currently unmaintained pwhash, with updated dependencies.

See the documentation for API reference.

Getting Started

Add the following to the [dependencies] section of your Cargo.toml:

pw_hash = "0.1"

Example

use pw_hash::bcrypt;

// Hash a password with default parameters.
let h_new = bcrypt::hash("password").unwrap();

// Verify a password against an existing hash.
let h = "$2y$05$bvIG6Nmid91Mu9RcmmWZfO\
         5HJIMCT8riNW0hEp8f6/FuA2/mHZFpe";
assert!(bcrypt::verify("password", h));

Summary

The following algorithms are currently implemented (in alphabetical order):

  • bcrypt

  • bsdi_crypt

  • md5_crypt

  • sha1_crypt

  • sha256_crypt

  • sha512_crypt

  • unix_crypt

Each algorithm resides in its eponymous module, and provides the following interface:

  • verify(): verify a password against a hash.

  • hash(): hash a password with default algorithm-spacific parameters.

  • hash_with(): hash a password with customized parameters.

There is also a convenience module unix which provides the functions unix::crypt, a crypt(3) work-alike, and unix::verify.

Commit count: 0

cargo fmt