ddn.api.crypto.mac

MAC (Message Authentication Code) API.

iface MAC

Types 1

interfaceMAC

Interface for Message Authentication Codes (MAC).

A MAC provides data integrity and authenticity by computing a tag over a message using a secret key. The receiver can verify the tag using the same key.

Typical usage:

mac.initialize(key);
mac.update(message1);
mac.update(message2);
auto tag = mac.finish();

Methods
void initialize(const(ubyte)[] key)Initializes (or re-initializes) the MAC with the given secret key.
MAC update(const(ubyte)[] input)Updates the MAC with the given input data.
ubyte[] finish()Finalizes the MAC computation and returns the tag.
void reset()Resets the MAC to its initial state.
size_t size() @property const @safe pure nothrow @nogcReturns: The size of the MAC tag in bytes.