HMAC class

The HMAC class represents a Hash-based Message Authentication Code.

It computes a MAC using a given hash function with a secret key and input data.

Implemented types

Constructors

HMAC(HashFunc hash, List<int> key, [int? blockSize])
Creates an HMAC instance with the specified hash function and secret key.

Properties

getBlockSize int
block size
no setteroverride
getDigestLength int
digest length
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clean() → void
Clean up the internal state and reset hash object to its initial state.
override
cleanSavedState(dynamic savedState) → void
Clean up and reset the saved state of the hash object to its initial state. This function erases the buffer and sets the state and length to the default values. It is used to ensure that a previously saved hash state is cleared and ready for reuse.
override
digest() List<int>
Generates the final hash digest by assembling and returning the hash state in a List
override
finish(List<int> out) HMAC
Finalizes the hash computation and stores the hash state in the provided List
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() HMAC
Resets the hash computation to its initial state.
override
restoreState(dynamic savedState) HMAC
Restores the hash computation state from a previously saved state.
override
saveState() HashState
Saves the current hash computation state into a serializable state object.
override
toString() String
A string representation of this object.
inherited
update(List<int> data) Hash
Updates the hash computation with the given data.
override

Operators

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

Static Methods

hmac(HashFunc hash, List<int> key, List<int> data) List<int>
Calculates an HMAC using a specified hash function, a secret key, and input data. The hash parameter should be a function that returns a hash instance, e.g., SHA1, SHA256, etc.