Aegis128LMACState

AEGIS-128L MAC state.

Manages the lifecycle of an aegis128l_mac_state object in a @nogc and @trusted context.

Constructors

this
this(const(ubyte)[] key, const(ubyte)[] nonce)

Initializes the AEGIS-128L MAC state with the provided key and nonce.

Destructor

~this
~this()

Destructor to clean up the MAC state.

Postblit

this(this)
this(this)

Disabled copy constructor to prevent state duplication.

Members

Functions

finalize
int finalize(ubyte[] mac, size_t maclen)

Finalizes the MAC computation, producing the MAC.

reset
void reset()

Resets the MAC state for reuse with the same key and nonce.

update
int update(const(ubyte)[] message)

Updates the MAC state with a message chunk.

verify
int verify(const(ubyte)[] mac, size_t maclen)

Verifies a MAC against the computed MAC.

Examples

ubyte[16] key = [0x01, 0x02, ..., 0x10];
ubyte[16] nonce = [0x00, 0x01, ..., 0x0F];
ubyte[] message = [0x48, 0x65, 0x6C, 0x6C, 0x6F]; // "Hello"
ubyte[16] mac;

auto macState = Aegis128LMACState(key, nonce);
macState.update(message);
macState.finalize(mac[], 16);

Meta