MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / hmac_rejects_tampered_data

Function hmac_rejects_tampered_data

nodedb-cluster/src/rpc_codec/mac.rs:123–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121
122 #[test]
123 fn hmac_rejects_tampered_data() {
124 let key = MacKey::from_bytes([7u8; MAC_LEN]);
125 let tag = compute_hmac(&key, b"hello world");
126 let err = verify_hmac(&key, b"hello WORLD", &tag).unwrap_err();
127 assert!(err.to_string().contains("MAC verification failed"));
128 }
129
130 #[test]
131 fn hmac_rejects_wrong_key() {

Callers

nothing calls this directly

Calls 2

verify_hmacFunction · 0.85
compute_hmacFunction · 0.70

Tested by

no test coverage detected