init method
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, CipherParameters? params) {
if (params is KeyParameter) {
var keyMaster = params.key;
if (keyMaster.length != 24 && keyMaster.length != 16) {
throw ArgumentError('key size must be 16 or 24 bytes.');
}
this.forEncryption = forEncryption;
var key1 = Uint8List(8);
_arrayCopy(keyMaster, 0, key1, 0, key1.length);
workingKey1 = generateWorkingKey(forEncryption, key1);
var key2 = Uint8List(8);
_arrayCopy(keyMaster, 8, key2, 0, key2.length);
workingKey2 = generateWorkingKey(!forEncryption, key2);
if (keyMaster.length == 24) {
var key3 = Uint8List(8);
_arrayCopy(keyMaster, 16, key3, 0, key3.length);
workingKey3 = generateWorkingKey(forEncryption, key3);
} else {
workingKey3 = workingKey1;
}
}
}