Encryption class

A class that provides encryption and decryption functionality.

Constructors

Encryption.new({EncryptionAlgorithm algorithm = EncryptionAlgorithm.aes256, required String encryptionKey})
Creates a new instance of Encryption.

Properties

algorithm EncryptionAlgorithm
The encryption algorithm to use.
final
encryptionKey String
The encryption key.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decrypt(String encryptedData) String
Decrypts the given encrypted data.
encrypt(String data) String
Encrypts the given data.
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

deriveKeyFromPassword({required String password, required String salt, int iterations = 10000, int keyLength = 32}) String
Derives a key from a password using PBKDF2.
generateSecureKey({int length = 32}) String
Generates a secure random key.
pbkdf2({required List<int> bytes, required List<int> salt, required int iterations, required int keyLength, required Hash hashAlgorithm}) List<int>
Implements PBKDF2 (Password-Based Key Derivation Function 2).