1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! 密码哈希模块
//!
//! 提供安全的密码哈希和验证功能,支持多种哈希算法。
//!
//! ## 支持的算法
//!
//! - **Argon2** (推荐): 内存硬哈希算法,抵抗 GPU/ASIC 攻击(需启用 `argon2` feature)
//! - **bcrypt**: 经典的密码哈希算法,广泛使用(需启用 `bcrypt` feature)
//!
//! ## Features
//!
//! - `argon2` - 启用 Argon2id 密码哈希支持(默认启用)
//! - `bcrypt` - 启用 bcrypt 密码哈希支持
//!
//! ## 示例
//!
//! ### 使用默认算法
//!
//! ```rust
//! use authrs::password::{hash_password, verify_password};
//!
//! // 哈希密码
//! let hash = hash_password("my_secure_password").unwrap();
//!
//! // 验证密码
//! let is_valid = verify_password("my_secure_password", &hash).unwrap();
//! assert!(is_valid);
//! ```
//!
//! ### 使用指定算法
//!
//! use authrs::password::{PasswordHasher, Algorithm};
//!
//! let hasher = PasswordHasher::new(Algorithm::Bcrypt);
//! let hash = hasher.hash("my_password").unwrap();
//! let is_valid = hasher.verify("my_password", &hash).unwrap();
//! ```
//!
//! ### 密码强度检查
//!
//! ```rust
//! use authrs::password::validate_password_strength;
//!
//! let result = validate_password_strength("weak");
//! assert!(result.is_err());
//!
//! let result = validate_password_strength("Str0ng_P@ssword!");
//! assert!(result.is_ok());
//! ```
pub use ;
pub use ;