1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Salsa20 symmetric cypher stream.
//!
//! Secure an `AsyncWrite + AsyncRead` type by layering over it two
/// [Salsa20](https://github.com/RustCrypto/stream-ciphers) stream ciphers.

mod connector;
mod acceptor;
mod stream;
mod model;

#[cfg(feature = "hyper")]
mod for_hyper_client;

pub use self::model::{WrapKey, Psk, Randomness, load_psk};
pub use self::stream::SalsaStream;
pub use self::connector::Connector;
pub use self::acceptor::{StreamAcceptor, TcpListenAcceptor, Acceptor, Accept};

#[cfg(feature = "hyper")]
pub use self::for_hyper_client::HyperSalsaConnector;

/// To ensure keys and other valuable bits of info don't linger in memory, this function
/// is called when possible to zero out the memory referred to in `slice`.
pub fn erase_bytes(slice: &mut [u8]) {
    slice
        .iter_mut()
        .for_each(|b| {
            *b = 0
        });
}