pub struct Pbkdf2Hasher { /* private fields */ }Expand description
PBKDF2-HMAC-SHA256 密码哈希器(基于 RustCrypto pbkdf2 crate)
使用 PBKDF2-HMAC-SHA256 算法(RFC 8018)。
哈希格式:$<iterations>$<salt_hex>$<hash_hex>
Implementations§
Source§impl Pbkdf2Hasher
impl Pbkdf2Hasher
Sourcepub const MIN_ITERATIONS: u32 = 100_000
pub const MIN_ITERATIONS: u32 = 100_000
迭代次数上下限(v4.8.0 修复 M-8):
- 下限与生产默认值对齐,拒绝 c<100_000 的弱哈希(黑帽实证 c=1 被接受);
- 上限防
$4294967295$...CPU DoS(单次校验可卡死数分钟)。
pub const MAX_ITERATIONS: u32 = 10_000_000
pub fn new() -> Self
pub fn with_iterations(iterations: u32) -> Self
Trait Implementations§
Source§impl Default for Pbkdf2Hasher
impl Default for Pbkdf2Hasher
Source§impl PasswordHasher for Pbkdf2Hasher
impl PasswordHasher for Pbkdf2Hasher
Auto Trait Implementations§
impl Freeze for Pbkdf2Hasher
impl RefUnwindSafe for Pbkdf2Hasher
impl Send for Pbkdf2Hasher
impl Sync for Pbkdf2Hasher
impl Unpin for Pbkdf2Hasher
impl UnsafeUnpin for Pbkdf2Hasher
impl UnwindSafe for Pbkdf2Hasher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more