[][src]Crate rust_sodium

Rust bindings to the sodium library.

Sodium is a portable implementation of Dan Bernsteins NaCl: Networking and Cryptography library.

For details on building rust_sodium, see the README.

For most users, if you want public-key (asymmetric) cryptography you should use the functions in crypto::box_ for encryption/decryption.

If you want secret-key (symmetric) cryptography you should be using the functions in crypto::secretbox for encryption/decryption.

For public-key signatures you should use the functions in crypto::sign for signature creation and verification.

Unless you know what you're doing you most certainly don't want to use the functions in crypto::scalarmult, crypto::stream, crypto::auth and crypto::onetimeauth.

Thread Safety

All functions in this library are thread-safe provided that the init() function has been called during program execution.

If init() hasn't been called then all functions except the random-number generation functions and the key-generation functions are thread-safe.

Public-key cryptography

crypto::box_

crypto::sign

Sealed boxes

crypto::sealedbox

Secret-key cryptography

crypto::secretbox

crypto::stream

crypto::auth

crypto::onetimeauth

Low-level functions

crypto::hash

crypto::verify

crypto::shorthash

Modules

crypto

Cryptographic functions

randombytes

Cryptographic random number generation.

utils

Libsodium utility functions

version

Libsodium version functions

Functions

init

Initialises libsodium and chooses faster versions of the primitives if possible. Also makes the random number generation functions (gen_key, gen_keypair, gen_nonce, randombytes, randombytes_into) thread-safe.

init_with_rng

Sets [libsodium's randombytes_implementation] (https://download.libsodium.org/doc/advanced/custom_rng.html) to use a Rust Rng implementation and initialises libsodium. See the rust_sodium-sys' docs for further details.