Compute HMAC-SHA256(key, data).
(key: &[u8], data: &[u8])
| 24 | |
| 25 | /// Compute HMAC-SHA256(key, data). |
| 26 | pub fn compute_hmac(key: &[u8], data: &[u8]) -> [u8; HMAC_SIZE] { |
| 27 | let mut mac = HmacSha256::new_from_slice(key).expect("HMAC accepts any key length"); |
| 28 | mac.update(data); |
| 29 | mac.finalize().into_bytes().into() |
| 30 | } |
| 31 | |
| 32 | /// Generate a random 32-byte nonce. |
| 33 | fn random_nonce() -> [u8; NONCE_SIZE] { |
no outgoing calls
no test coverage detected