#[repr(C)]pub struct Nonce(pub [u8; 24]);Expand description
A single-use value used during encryption. Each encrypted/sealed box must have its own nonce.
Tuple Fields§
§0: [u8; 24]Implementations§
Source§impl Nonce
impl Nonce
Sourcepub fn zero() -> Nonce
pub fn zero() -> Nonce
A nonce, filled with zeros. This is used during the ssb handshake, and probably shouldn’t be used otherwise.
Sourcepub fn generate_with_rng<R>(r: &mut R) -> Nonce
pub fn generate_with_rng<R>(r: &mut R) -> Nonce
Generate a new, random nonce using the given cryptographically-secure random number generator.
Sourcepub fn from_slice(s: &[u8]) -> Option<Self>
pub fn from_slice(s: &[u8]) -> Option<Self>
Deserialize a nonce from a byte slice.
Returns None if the byte slice length isn’t 24.
Trait Implementations§
impl Copy for Nonce
impl FromBytes for Nonce
Auto Trait Implementations§
impl Freeze for Nonce
impl RefUnwindSafe for Nonce
impl Send for Nonce
impl Sync for Nonce
impl Unpin for Nonce
impl UnwindSafe for Nonce
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