sign method
Signs a message digest using the ECDSA algorithm on the secp256k1 curve.
Optionally, the message can be hashed before signing.
Parameters:
digest: The message digest to be signed.hashMessage: Whether to hash the message before signing (default is true).
Returns:
- A byte list representing the signature of the message digest.
Throws:
- CryptoSignException if the digest length is invalid.
Implementation
List<int> sign(List<int> digest,
{bool hashMessage = true, List<int>? extraEntropy}) {
final hash = hashMessage ? QuickCrypto.sha256Hash(digest) : digest;
return _ecdsaSigningKey
.sign(digest: hash, extraEntropy: extraEntropy)
.item1
.toBytes(CryptoSignerConst.curveSecp256k1.baselen);
}