MCPcopy Create free account
hub / github.com/evilsocket/cake / compute_hmac

Function compute_hmac

cake-core/src/cake/sharding/auth.rs:26–30  ·  view source on GitHub ↗

Compute HMAC-SHA256(key, data).

(key: &[u8], data: &[u8])

Source from the content-addressed store, hash-verified

24
25/// Compute HMAC-SHA256(key, data).
26pub 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.
33fn random_nonce() -> [u8; NONCE_SIZE] {

Callers 4

compute_hmac_32bFunction · 0.85
compute_hmac_1kbFunction · 0.85
authenticate_as_masterFunction · 0.85
authenticate_as_workerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected