[][src]Struct bdrck::crypto::key::Nonce

pub struct Nonce { /* fields omitted */ }

A cryptographic nonce is an arbitrary number that can be used only once (e.g. for encryption).

Methods

impl Nonce[src]

pub fn new() -> Self[src]

Return a new, zero-initialized nonce.

pub fn from_bytes(bytes: &[u8]) -> Result<Self>[src]

Construct a new Nonce from raw bytes. The given byte slice must be exactly NONCE_BYTES long.

pub fn increment(self) -> Self[src]

Increment this nonce's bytes by 1. This is useful for counter-style nonces.

pub fn as_bytes(&self) -> &[u8][src]

Access the raw bytes which make up this Nonce.

Trait Implementations

impl Clone for Nonce[src]

impl Debug for Nonce[src]

impl Default for Nonce[src]

fn default() -> Self[src]

Return a new randomly generated nonce. This is the default, because it's safer / less error prone vs. e.g. accidentally using a zeroed out nonce twice.

impl<'de> Deserialize<'de> for Nonce[src]

impl Eq for Nonce[src]

impl PartialEq<Nonce> for Nonce[src]

impl Serialize for Nonce[src]

impl StructuralEq for Nonce[src]

impl StructuralPartialEq for Nonce[src]

Auto Trait Implementations

impl RefUnwindSafe for Nonce

impl Send for Nonce

impl Sync for Nonce

impl Unpin for Nonce

impl UnwindSafe for Nonce

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,