pub struct Params { /* private fields */ }Expand description
The Argon2 parameters used for the encrypted data.
Implementations§
source§impl Params
impl Params
sourcepub fn new(ciphertext: impl AsRef<[u8]>) -> Result<Self>
pub fn new(ciphertext: impl AsRef<[u8]>) -> Result<Self>
Creates a new instance of the Argon2 parameters from ciphertext.
Errors
Returns Err if any of the following are true:
ciphertextis shorter than 156 bytes.- The magic number is invalid.
- The version number is the unrecognized abcrypt version number.
- The Argon2 parameters are invalid.
Examples
let ciphertext = include_bytes!("../tests/data/data.txt.abcrypt");
assert!(Params::new(ciphertext).is_ok());sourcepub const fn m_cost(&self) -> u32
pub const fn m_cost(&self) -> u32
Gets memory size in KiB.
Examples
let ciphertext = include_bytes!("../tests/data/data.txt.abcrypt");
let params = Params::new(ciphertext).unwrap();
assert_eq!(params.m_cost(), 32);Trait Implementations§
impl Copy for Params
Auto Trait Implementations§
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
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