Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inejge/pwhash
A collection of password hashing routines in pure Rust
https://github.com/inejge/pwhash
Last synced: 3 months ago
JSON representation
A collection of password hashing routines in pure Rust
- Host: GitHub
- URL: https://github.com/inejge/pwhash
- Owner: inejge
- License: mit
- Created: 2016-02-09T21:36:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-06T21:57:51.000Z (about 2 years ago)
- Last Synced: 2024-06-19T05:56:06.020Z (5 months ago)
- Language: Rust
- Size: 759 KB
- Stars: 59
- Watchers: 5
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# pwhash
A collection of password hashing and verification routines.
See the [documentation](https://docs.rs/pwhash/1.0.0/pwhash/) for API reference.
## Getting Started
Add the following to the `[dependencies]` section of your `Cargo.toml`:
```toml
pwhash = "1"
```## Example
```rust
use pwhash::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`.