pub struct ScryptBuilder<'a> { /* private fields */ }Expand description
Scrypt key-derivation builder (RFC 7914).
ⓘ
let dk = ScryptBuilder::new(b"password", b"NaCl")
.params(ScryptParams { n: 1 << 20, ..ScryptParams::default() })
.derive_to_vec(64)?;Implementations§
Source§impl<'a> ScryptBuilder<'a>
impl<'a> ScryptBuilder<'a>
Sourcepub fn new(password: &'a [u8], salt: &'a [u8]) -> Self
pub fn new(password: &'a [u8], salt: &'a [u8]) -> Self
Create a scrypt builder.
Cost parameters default to ScryptParams::default().
Sourcepub fn params(self, params: ScryptParams) -> Self
pub fn params(self, params: ScryptParams) -> Self
Override the cost parameters.
Sourcepub fn derive(self, out: &mut [u8]) -> Result<(), ErrorStack>
pub fn derive(self, out: &mut [u8]) -> Result<(), ErrorStack>
Derive key material, writing into out.
§Errors
Sourcepub fn derive_to_vec(self, len: usize) -> Result<Vec<u8>, ErrorStack>
pub fn derive_to_vec(self, len: usize) -> Result<Vec<u8>, ErrorStack>
Derive len bytes of key material, returning them in a freshly allocated Vec<u8>.
§Errors
Auto Trait Implementations§
impl<'a> Freeze for ScryptBuilder<'a>
impl<'a> RefUnwindSafe for ScryptBuilder<'a>
impl<'a> Send for ScryptBuilder<'a>
impl<'a> Sync for ScryptBuilder<'a>
impl<'a> Unpin for ScryptBuilder<'a>
impl<'a> UnsafeUnpin for ScryptBuilder<'a>
impl<'a> UnwindSafe for ScryptBuilder<'a>
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