hash property
Uint8List
get
hash
Computes the hash of the script.
This method converts the script to its CBOR representation, adds a tag based on the script type, and then computes the Blake2b hash of the resulting bytes.
Implementation
Uint8List get hash {
final cborValue = toCbor();
final bytesToHash = cborValue is CborBytes
? _handleDoubleEncodedCbor(cborValue.bytes)
: cborValue;
final cborBytes = cbor.encode(bytesToHash);
final bytes = Uint8List.fromList([tag, ...cborBytes]);
return Hash.blake2b(bytes, digestSize: scriptHashSize);
}