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

Encryptor({String? key, int? round})
Constructs an Encryptor instance with an optional key and round.

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 data using the configured key and rounds.
enc(String data) String
Encrypts data using 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 optional key. 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 data string with an optional key. Returns base64-encoded string containing both IV and encrypted data.