Expand description
Aggregate MAC for efficient multi-message authentication.
This module provides aggregate Message Authentication Codes (MACs) that allow authenticating multiple messages with a single verification step. This is particularly useful for:
- Batch verification of content chunks in P2P networks
- Reducing verification overhead when processing many messages
- Bandwidth-efficient authentication of large datasets
The aggregate MAC scheme uses BLAKE3 keyed hashing with domain separation:
- Each message is tagged with its index for domain separation
- Individual MACs are combined via XOR aggregation
- Single aggregate tag can verify all messages at once
- Constant-size tags regardless of number of messages
§Example
use chie_crypto::aggregate_mac::{AggregateMacKey, AggregateMacBuilder};
// Generate a key
let key = AggregateMacKey::generate();
// Authenticate multiple messages
let messages = vec![b"chunk1".as_slice(), b"chunk2".as_slice(), b"chunk3".as_slice()];
let builder = AggregateMacBuilder::new(&key);
let aggregate_tag = builder.authenticate_batch(&messages);
// Verify all messages at once
let valid = key.verify_batch(&messages, &aggregate_tag);
assert!(valid);Structs§
- Aggregate
MacBuilder - Builder for creating aggregate MACs.
- Aggregate
MacKey - Aggregate MAC key.
- Aggregate
Tag - Aggregate MAC tag.
- MacTag
- Individual MAC tag for a single message.
Enums§
- Aggregate
MacError - Errors that can occur during aggregate MAC operations.
Type Aliases§
- Aggregate
MacResult - Result type for aggregate MAC operations.