pub struct Argon2 { /* private fields */ }Expand description
The Argon2 context used for the encrypted data.
Implementations§
Source§impl Argon2
impl Argon2
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 context from ciphertext.
§Errors
Returns Err if any of the following are true:
ciphertextis shorter than 164 bytes.- The magic number is invalid.
- The version number is the unsupported abcrypt version number.
- The version number is the unrecognized abcrypt version number.
- The Argon2 type is invalid.
- The Argon2 version is invalid.
- The Argon2 parameters are invalid.
§Examples
let ciphertext = include_bytes!("../tests/data/v1/argon2id/v0x13/data.txt.abcrypt");
assert!(Argon2::new(ciphertext).is_ok());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Argon2
impl RefUnwindSafe for Argon2
impl Send for Argon2
impl Sync for Argon2
impl Unpin for Argon2
impl UnwindSafe for Argon2
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