prepare method

  1. @override
void prepare(
  1. KeyParameter keyParam
)

Prepare for a stream of data. This method is called during initialization and reset.

Implementation

@override
void prepare(KeyParameter keyParam) {
  if (macSize != 16) {
    throw ArgumentError('macSize should be equal to 16 for GCM');
  }

  underlyingCipher.init(true, keyParam);

  _h = Uint8List(blockSize);
  underlyingCipher.processBlock(_h, 0, _h, 0);

  _counter = _computeInitialCounter(nonce);

  _e0 = Uint8List(16);
  _computeE(_counter, _e0);

  _e = Uint8List(16);

  _x = Uint8List(16);

  _processedBytes = 0;
}