MacAlgorithm class abstract

A Message Authentication Code (MAC) algorithm.

You can compute a Mac by calling calculateMac or newMacSink.

Available algorithms

Not using MAC?

If are sure you don't need a MAC, you can use MacAlgorithm.empty:

final example = ChaCha20(macAlgorithm: MacAlgorithm.empty);
Implementers

Constructors

MacAlgorithm()
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
keyStreamUsed → int
Number of bytes in key stream used to initialize the MAC algorithm.
no setter
macLength → int
Number of bytes in the message authentication code.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supportsAad → bool
Whether the algorithm supports Associated Authenticated Data (AAD).
no setter
supportsKeyStreamIndex → bool
Whether the algorithm supports key stream index.
no setter

Methods

calculateMac(List<int> bytes, {required SecretKey secretKey, List<int> nonce = const <int>[], List<int> aad = const <int>[]}) → Future<Mac>
Calculates message authentication code.
checkParameters({int? length, required SecretKey secretKey, required int nonceLength, required int aadLength, required int keyStreamIndex}) → void
Checks parameters and throws ArgumentError if they are invalid.
newMacSink({required SecretKey secretKey, List<int> nonce = const <int>[], List<int> aad = const <int>[]}) → Future<MacSink>
Constructs a sink for calculating a Mac.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override
toSync() → DartMacAlgorithm
Returns a synchronous implementation of this algorithm.

Operators

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

Constants

empty → const MacAlgorithm
MAC algorithm that always returns Mac.empty.