Pwhash
A collection of password hashing routines in pure Rust
Install / Use
/learn @inejge/PwhashREADME
pwhash
A collection of password hashing and verification routines.
See the documentation for API reference.
Getting Started
Add the following to the [dependencies] section of your Cargo.toml:
pwhash = "1"
Example
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.
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
