[][src]Struct ssb_crypto::NonceGen

pub struct NonceGen { /* fields omitted */ }

Methods

impl NonceGen[src]

pub fn new(pk: &EphPublicKey, net_id: &NetworkKey) -> NonceGen[src]

pub fn with_starting_nonce(nonce: Nonce) -> NonceGen[src]

#Examples

use ssb_crypto::NonceGen;
use sodiumoxide::crypto::secretbox::Nonce;

let nonce_bytes = [0, 0, 0, 0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0, 0, 255, 255];
let mut gen = NonceGen::with_starting_nonce(Nonce::from_slice(&nonce_bytes).unwrap());
let n1 = gen.next();
assert_eq!(&n1[..], &nonce_bytes);
let n2 = gen.next();
assert_eq!(&n2[..], [0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 0, 0, 0,
                     0, 0, 0, 0, 0, 1, 0, 0]);

pub fn next(&mut self) -> Nonce[src]

Auto Trait Implementations

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> From<T> for T[src]

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

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.