init method

  1. @override
void init(
  1. bool forEncryption,
  2. covariant ParametersWithIV<CipherParameters?> params
)
override

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

Use the argument forEncryption to tell the cipher if you want to encrypt or decrypt data.

Implementation

@override
void init(bool forEncryption, covariant ParametersWithIV params) {
  if (params.iv.length != blockSize * 2) {
    throw ArgumentError(
        'Initialization vector must be the same length as block size');
  }

  _encrypting = forEncryption;
  arrayCopy(params.iv, 0, _x0, 0, blockSize);
  arrayCopy(params.iv, blockSize, _y0, 0, blockSize);

  reset();

  _underlyingCipher.init(forEncryption, params.parameters);
}