HiveAesCipher constructor
Create a cipher with the given key
.
Implementation
HiveAesCipher(List<int> key) {
if (key.length != 32 || key.any((it) => it < 0 || it > 255)) {
throw ArgumentError(
'The encryption key has to be a 32 byte (256 bit) array.',
);
}
final keyBytes = Uint8List.fromList(key);
_cipher = AesCbcPkcs7(keyBytes);
_keyCrc = Crc32.compute(sha256.convert(keyBytes).bytes as Uint8List);
}