init method

  1. @override
void init(
  1. CipherParameters params
)
override

Init the MAC with its initialization params. The type of CipherParameters depends on the algorithm being used (see the documentation of each implementation to find out more).

Implementation

@override
void init(CipherParameters params) {
  Uint8List? nonce;

  if (cipher != null) {
    if (params is! ParametersWithIV) {
      throw ArgumentError(
          'Poly1305 requires an IV when used with a block cipher.');
    }

    nonce = params.iv;
    params = params.parameters!;
  }

  if (params is! KeyParameter) {
    throw ArgumentError('Poly1305 requires a key.');
  }

  if (!checkKey(params.key)) clamp(params.key);

  setKey(params.key, nonce);

  reset();
}