validateAndHashKey method
List<int>
validateAndHashKey(
- List<
int> pubKey, { - PubKeyModes pubKeyMode = PubKeyModes.compressed,
Implementation
List<int> validateAndHashKey(
List<int> pubKey, {
PubKeyModes pubKeyMode = PubKeyModes.compressed,
}) {
/// Validate and process the public key as a Secp256k1 key.
final publicKey = AddrKeyValidator.validateAndGetSecp256k1Key(pubKey);
/// Determine the public key bytes based on the selected mode.
final List<int> pubKeyBytes =
pubKeyMode == PubKeyModes.compressed
? publicKey.compressed
: publicKey.uncompressed;
/// Calculate the hash160 of the public key.
final hash160 = QuickCrypto.hash160(pubKeyBytes);
/// Combine the network version and hash160 to form the address bytes.
return hash160;
}