Generate a random 32-byte nonce.
()
| 31 | |
| 32 | /// Generate a random 32-byte nonce. |
| 33 | fn random_nonce() -> [u8; NONCE_SIZE] { |
| 34 | let mut nonce = [0u8; NONCE_SIZE]; |
| 35 | rand::thread_rng().fill_bytes(&mut nonce); |
| 36 | nonce |
| 37 | } |
| 38 | |
| 39 | /// Constant-time comparison of two byte slices. |
| 40 | pub fn constant_time_eq(a: &[u8], b: &[u8]) -> bool { |
no outgoing calls
no test coverage detected