digest method
Computes and returns the Poly1305 message authentication code (MAC) for the current state.
This method finalizes the Poly1305 authentication and produces the authentication code (MAC) based on the current state of the instance. After calling this method, further updates or finishing operations are not allowed.
Returns:
A List<int>
containing the computed Poly1305 message authentication code (MAC).
Throws:
StateError
if thePoly1305
instance was already finished before callingdigest
.
This method is used to obtain the final MAC from the current Poly1305 state, and it should not be called
after the Poly1305
instance has been finished.
Implementation
List<int> digest() {
if (_finished) {
throw const MessageException("Poly1305 was finished");
}
List<int> mac = List<int>.filled(16, 0);
finish(mac);
return mac;
}