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
31
32
33
34
35
36
37
38
39
40
41
42
//! Cryptographic functions.
//!
//! For long running programs, you should initialize the sodium
//! library for optimal performance.
//!
//! ```rust
//! use stellar_base::crypto;
//!
//! # fn run() -> stellar_base::error::Result<()> {
//! crypto::init()?;
//! // your program here.
//! # Ok(())
//! # }
//! ```
use crate;
use sha256;
use randombytes;
pub use ;
pub use *;
/// Compute sha256 hash of `m`.
/// Generate `size` random bytes.
/// Initialize the sodium library and chooses faster version of the primitives
/// if possible.
///
/// `init` also makes `KeyPair::random()` thread-safe.