HiveAesNativeCbcCipher class

Multi-threaded cipher. Uses AES256 CBC

IMPORTANT: Setup required: https://pub.dev/packages/cryptography_flutter#getting-started

  1. add dependency to pubspec.yaml
dependencies:
  cryptography_flutter: ^2.0.2
  1. 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

Constructors

HiveAesNativeCbcCipher(List<int> key)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secretKey Completer<SecretKey>
final

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 text
  • inpOff: the byte offset to start encryption at
  • inpLength: the number of bytes (length) to encrypt
  • out: the buffer to write the encrypted output in
  • outOff: the byte offset to write the encrypted output to
  • override
    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