Crates.io | hashed_password |
lib.rs | hashed_password |
version | 1.3.0 |
source | src |
created_at | 2024-09-23 14:35:12.953198 |
updated_at | 2024-09-23 15:51:06.004734 |
description | Password hasher |
homepage | |
repository | https://github.com/caojen/password_hasher |
max_upload_size | |
id | 1384168 |
size | 5,183 |
A rust library to handle password storage.
First, create a HashedPassword
:
use hashed_password::HashedPassword;
let hashed = HashedPassword::from_plain("MyPlainPassword", b"my-secret");
println!("hashed data: {}", hashed.as_str());
Then, validate any plain:
hashed.validate("MyPlainPassword", b"my-secret"); // true
hashed.validate("MyPlainPassword", b"wrong-secret"); // false
hashed.validate("WrongPlainPassword", b"my-secret"); // false
serde
: enable serde
sqlx
: enable sqlx
and derive sqlx::FromRow