pub struct BalloonHasher {
pub variant: BalloonVariant,
pub params: BalloonParams,
}Expand description
A Balloon password hasher bundling its variant and cost parameters.
Implements PasswordHash so it composes
with crate::verify_password.
§Design note — params argument is ignored
PasswordHash::hash_password
accepts a params: &dyn PasswordHashParams, but this implementation uses
self.params instead. The output length is fixed by the variant (32 bytes
for SHA-256, 64 for SHA-512); out must match.
Fields§
§variant: BalloonVariantUnderlying hash variant.
params: BalloonParamsCost parameters.
Implementations§
Source§impl BalloonHasher
impl BalloonHasher
Sourcepub fn new_sha256(params: BalloonParams) -> BalloonHasher
pub fn new_sha256(params: BalloonParams) -> BalloonHasher
Create a Balloon-SHA-256 hasher with the given parameters.
Sourcepub fn new_sha512(params: BalloonParams) -> BalloonHasher
pub fn new_sha512(params: BalloonParams) -> BalloonHasher
Create a Balloon-SHA-512 hasher with the given parameters.
Sourcepub fn output_len(&self) -> usize
pub fn output_len(&self) -> usize
Digest length in bytes for this hasher’s variant.
Trait Implementations§
Source§impl Clone for BalloonHasher
impl Clone for BalloonHasher
Source§fn clone(&self) -> BalloonHasher
fn clone(&self) -> BalloonHasher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BalloonHasher
Source§impl Debug for BalloonHasher
impl Debug for BalloonHasher
Source§impl PasswordHash for BalloonHasher
impl PasswordHash for BalloonHasher
Source§fn hash_password(
&self,
password: &[u8],
salt: &[u8],
_params: &dyn PasswordHashParams,
out: &mut [u8],
) -> Result<(), CryptoError>
fn hash_password( &self, password: &[u8], salt: &[u8], _params: &dyn PasswordHashParams, out: &mut [u8], ) -> Result<(), CryptoError>
Hash
password with salt using the given params; write output into out.Auto Trait Implementations§
impl Freeze for BalloonHasher
impl RefUnwindSafe for BalloonHasher
impl Send for BalloonHasher
impl Sync for BalloonHasher
impl Unpin for BalloonHasher
impl UnsafeUnpin for BalloonHasher
impl UnwindSafe for BalloonHasher
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