CryptoMisc class

these methods use several external packages such as hex and crypto. The hex package provides functions for encoding and decoding hexadecimal strings, while the crypto package provides cryptographic functions for hashing and key derivation. These packages provide basic cryptographic capabilities for Flutter applications.

Constructors

CryptoMisc()

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

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

descryptWallet(String encriptedWallet, String password) String
This method decrypts an encrypted string using the AES-256 algorithm with the given password and initialization vector (IV). It uses the Encrypter class from the encrypt library to perform the decryption. The encrypted string is expected to be in JSON format and contains an initialization vector and a ciphertext. The method returns the decrypted string in JSON format after converting it to the correct format using the StringUtilities.jsonNotEscapedToCorrectFormat method.
encryptWallet(KeyBean kb, String walletDirectory, String walletName, String password) → EncKeyBean
generateSignature(String signature, String publicKey) Future<Signature>
hash256ToHex(String input) String
This method takes a string input, converts it to bytes using UTF-8 encoding, computes the SHA3-256 hash of the bytes, and returns the hash value as a hexadecimal string.
pwHash(String input, String salt, int iterations, int bitLengthKey) Future<List<int>>
This method takes a string input, a salt string salt, an integer iterations for the number of iterations of the PBKDF2 algorithm, and an integer bitLengthKey for the bit length of the derived key. It then uses the PBKDF2 algorithm with HMAC-SHA512 as the MAC algorithm to derive a key from the input and salt strings. The derived key is returned as a list of integers.
signAndVerify(SimpleKeyPair keyPair, String message) Future<String>
The method is a static asynchronous method that performs signing and verification of a message using the Ed25519 digital signature algorithm The method takes a SimpleKeyPair object (keyPair) and a String (message) as input. An instance of the DartEd25519 class is created, configured with the Sha512 hashing algorithm for signature generation and verification. The signString method of the DartEd25519 instance is used to sign the message using the keyPair. This produces an unsignedSignature object. The verifyString method is then used to verify the signature by passing the message and the unsignedSignature to it. The result is stored in the isSignatureCorrect variable. If the signature is verified successfully (isSignatureCorrect is true), the following steps are performed: The signature bytes are converted to a base64 representation using the base64.encode function. The resulting base64 signature is then converted to a URL-safe base64 representation using the StringUtilities.convertFromBase64ToBase64UrlSafe method. The URL-safe base64 signature is returned as the result of the method. If the signature verification fails (isSignatureCorrect is false), an error is thrown using throw Error().
verifySign(TransactionBean tb) Future<bool>

Constants

dictionaryAllLength → const int
walletKeyChain → const String
wordsLength → const int