pub struct PasswordHashConfig {
pub algorithm: PasswordHashAlgorithm,
pub bcrypt_cost: u32,
pub argon2_memory_cost: u32,
pub argon2_time_cost: u32,
pub argon2_parallelism: u32,
}Expand description
密码哈希配置
Fields§
§algorithm: PasswordHashAlgorithm使用的哈希算法
bcrypt_cost: u32bcrypt 成本因子(4-31,推荐 12)
argon2_memory_cost: u32argon2 内存成本(KB)
argon2_time_cost: u32argon2 时间成本
argon2_parallelism: u32argon2 并行度
Implementations§
Source§impl PasswordHashConfig
impl PasswordHashConfig
Sourcepub fn new(algorithm: PasswordHashAlgorithm) -> Self
pub fn new(algorithm: PasswordHashAlgorithm) -> Self
Sourcepub fn with_bcrypt_cost(self, cost: u32) -> Self
pub fn with_bcrypt_cost(self, cost: u32) -> Self
Sourcepub fn with_argon2_memory_cost(self, cost: u32) -> Self
pub fn with_argon2_memory_cost(self, cost: u32) -> Self
Sourcepub fn with_argon2_time_cost(self, cost: u32) -> Self
pub fn with_argon2_time_cost(self, cost: u32) -> Self
Sourcepub fn with_argon2_parallelism(self, parallelism: u32) -> Self
pub fn with_argon2_parallelism(self, parallelism: u32) -> Self
Trait Implementations§
Source§impl Clone for PasswordHashConfig
impl Clone for PasswordHashConfig
Source§fn clone(&self) -> PasswordHashConfig
fn clone(&self) -> PasswordHashConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PasswordHashConfig
impl Debug for PasswordHashConfig
Source§impl Default for PasswordHashConfig
impl Default for PasswordHashConfig
Source§impl From<&PasswordHashConfig> for PasswordHasherConfig
impl From<&PasswordHashConfig> for PasswordHasherConfig
Source§fn from(config: &PasswordHashConfig) -> Self
fn from(config: &PasswordHashConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PasswordHashConfig
impl RefUnwindSafe for PasswordHashConfig
impl Send for PasswordHashConfig
impl Sync for PasswordHashConfig
impl Unpin for PasswordHashConfig
impl UnsafeUnpin for PasswordHashConfig
impl UnwindSafe for PasswordHashConfig
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