sendMac method
Generate and append a Message Authentication Code (MAC) to data in the Strobe protocol.
The sendMac
method is used to generate and append a Message Authentication Code (MAC) to data within the Strobe protocol.
This MAC ensures the integrity and authenticity of the data being sent over the communication channel.
Parameters:
meta
: A boolean flag indicating whether metadata is included in the operation.outputLength
: The desired output length of the generated MAC.
Returns:
- A List
Usage:
int desiredMacLength = 16; // Specify the desired MAC length in bytes.
List<int> generatedMac = strobeInstance.sendMac(true, desiredMacLength);
// Append the generated MAC to the data to be sent.
The sendMac
method plays a crucial role in ensuring data integrity during the transmission process by generating and appending MACs to the data to be sent.
Implementation
List<int> sendMac(bool meta, int outputLength) {
return operate(
meta, StrobeOperation.sendMac, List.empty(), outputLength, false);
}