HiveAesNativeCbcCipher class
Multi-threaded cipher. Uses AES256 CBC
IMPORTANT: Setup required: https://pub.dev/packages/cryptography_flutter#getting-started
- add dependency to pubspec.yaml
dependencies:
cryptography_flutter: ^2.0.2
- enable native implementations
import 'package:cryptography_flutter/cryptography_flutter.dart';
void main() {
// Enable Flutter cryptography
FlutterCryptography.enable();
// ....
}
This implementation extends the HiveCipher with native AES implementations
on Android, iOS, macOS as well as on web using AesCbc
.
This may highly decrease the delay in the event loop of the Flutter application. A disadvantage is the fact that each computation takes a bit longer than its main-thread equivalent because spawning a new thread takes its time.
- Inheritance
-
- Object
- HiveAesCipher
- HiveAesNativeCbcCipher
Constructors
-
HiveAesNativeCbcCipher(List<
int> key)
Properties
Methods
-
calculateKeyCrc(
) → int -
Calculate a hash of the key. Make sure to use a secure hash.
inherited
-
decrypt(
Uint8List inp, int inpOff, int inpLength, Uint8List out, int outOff) → Future< int> -
Decrypt the given bytes.
override
-
encrypt(
Uint8List inp, int inpOff, int inpLength, Uint8List out, int outOff) → Future< int> -
inp
: the total bytes in plain textinpOff
: the byte offset to start encryption atinpLength
: the number of bytes (length) to encryptout
: the buffer to write the encrypted output inoutOff
: the byte offset to write the encrypted output tooverride -
generateIv(
) → Uint8List -
Generates a random initialization vector (internal)
inherited
-
maxEncryptedSize(
Uint8List inp) → int -
The maximum size the input can have after it has been encrypted.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited