encrypt method
Encrypt bytes
.
Implementation
@override
Encrypted encrypt(Uint8List bytes, {IV? iv, Uint8List? associatedData}) {
if (mode != AESMode.ecb && iv == null) {
throw StateError('IV is required.');
}
if (_streamCipher != null) {
_streamCipher!
..reset()
..init(true, _buildParams(iv, associatedData: associatedData));
return Encrypted(_streamCipher!.process(bytes));
}
_cipher
..reset()
..init(true, _buildParams(iv, associatedData: associatedData));
if (padding != null) {
return Encrypted(_cipher.process(bytes));
}
return Encrypted(_processBlocks(bytes));
}