Hmac class final

HMAC (RFC 2104) over a SHA-family hash.

The keyed inner/outer pad states are compressed once at construction and snapshotted per message, so authenticating many messages under one key (PBKDF2's inner loop, WinZip AE streams) costs two compression calls per message beyond the data itself.

Usage per message: add chunks, then finish; reset rearms the same key for the next message.

Constructors

Hmac.sha1(Uint8List key)
HMAC-SHA1 with key (any length; longer than 64 bytes is hashed first, per RFC 2104).
Hmac.sha256(Uint8List key)
HMAC-SHA256 with key (any length).

Properties

digestSize int
MAC length in bytes (the underlying hash's digest size).
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Uint8List chunk, [int start = 0, int? end]) → void
Updates the current message with chunk[start..end).
compute(Uint8List data) Uint8List
Computes the MAC of data in one call (and rearms for the next message).
finish() Uint8List
Completes the current message and returns its MAC. Call reset before authenticating another message.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Rearms the MAC (same key) for a new message.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited