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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! General purpose utilities used by [`aether_lib`](crate) often.
use ;
/// Compile a 32-bit value into vector of bytes
///
/// # Arguments
///
/// * `nu32` - A `u32` integer value
///
/// # Examples
///
/// ```
/// use aether_lib::util::compile_u32;
/// let bytes: Vec<u8> = compile_u32(32);
/// ```
/// Compile a 16-bit value into vector of bytes
///
/// # Arguments
///
/// * `nu16` - A `u16` integer value
///
/// # Examples
///
/// ```
/// use aether_lib::util::compile_u16;
/// let bytes: Vec<u8> = compile_u16(3242);
/// ```
/// Generate a cryptographically secure random nonce of the given size in bytes
///
/// # Arguments
///
/// * `size` - Size of the nonce in bytes
///
/// # Examples
///
/// ```
/// use aether_lib::util::gen_nonce;
/// // to generate a 16 bytes nonce
/// let nonce = gen_nonce(16);
/// ```