Encryptor class
Provides simple symmetric encryption and decryption utilities.
NOTE: This is NOT a replacement for proper cryptography. For sensitive data,
use a package like encrypt or pointycastle, as this logic is not
cryptographically secure.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dec(
String data) → String -
Decrypts
datausing the configured key and rounds. -
enc(
String data) → String -
Encrypts
datausing the configured key and rounds. -
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
-
decrypt(
String encryptedData, {String? key, int round = 10_000}) → String -
Decrypts
encryptedData, a base64-encoded string created by encrypt, using an optionalkey. Returns the decrypted utf8-decoded string, or an empty string on failure. -
encrypt(
String data, {String? key, int round = 10_000}) → String -
Encrypts the given
datastring with an optionalkey. Returns base64-encoded string containing both IV and encrypted data.