SodiumHiveCipher class
An implementation of HiveCipher
that uses the SecretBox
for encryption.
You can use this as alternative to HiveAesCipher
in case you do not want
to rely on the correctness of their AES implementation. This class instead
uses the SecretBox.easy
algorithms to encrypt data for storage.
Constructors
- SodiumHiveCipher({required Sodium sodium, required SecureKey encryptionKey})
- Constructor.
Properties
- encryptionKey → SecureKey
-
The secret key used for encryption and decryption.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sodium → Sodium
-
The sodium instance the cipher uses.
final
Methods
-
calculateKeyCrc(
) → int -
Calculate a hash of the key. Make sure to use a secure hash.
override
-
decrypt(
Uint8List inp, int inpOff, int inpLength, Uint8List out, int outOff) → int -
Decrypt the given bytes.
override
-
encrypt(
Uint8List inp, int inpOff, int inpLength, Uint8List out, int outOff) → int -
Encrypt the given bytes.
override
-
maxEncryptedSize(
Uint8List inp) → int -
The maximum size the input can have after it has been encrypted.
override
-
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
Static Methods
-
keyBytes(
Sodium sodium) → int - The length (in bytes) the encryptionKey must be.