CryptoSimple class
The CryptoSimple class provides a simple encryption and decryption mechanism that relies on two keys: a superKey
and a subKey
.
The superKey
is used to shift the Unicode value of each character in the input string,
while the subKey
is used to obscure the shifted value .
The class also supports a secretKey
that can be used to further enhance the security of the encryption process.
Constructors
- CryptoSimple({int? superKey, int? subKey, String? secretKey, EncryptionMode? encryptionMode = EncryptionMode.Normal})
-
CryptoSimple factory constructor :
A factory constructor that creates and returns a new instance of the CryptoSimple class.
It takes several optional parameters, such as
superKey
,subKey
,secretKey
, andencryptionMode
, and performs input validation before setting the values of the corresponding instance variables.factory
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
-
decrypting(
{required String encrypted}) → String - decrypting method : This method decrypts the encrypted text using the superKey and subKey instance variables. It takes an encrypted text as an input and returns the decrypted text after performing decryption.
-
encrypting(
{required String inputString}) → String - encrypting method : This method encrypts the input text using the superKey and subKey instance variables. It takes a plain text as input and returns the encrypted text after performing encryption.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetObject(
) → void -
The resetObject method resets the
_lock
instance variable to false. It is used internally within the class to reset the lock after unit tests are run. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → CryptoSimple
-
instance getter method :
A getter method that returns the singleton instance of the CryptoSimple class.
no setter
Static Methods
-
decrypt(
{required String encrypted}) → String - The decrypt method takes an encrypted string encrypted as an argument and returns the decrypted version of the string. The method returns the decrypted string as a string.
-
encrypt(
{required String inputString}) → String - The encrypt method takes a string inputString as an argument and returns an encrypted version of the string. The method returns the encrypted string as a string.