crypto

sha256(key: Any) bytes

Encrypts a key using SHA-256.

Parameters

key (Any) – the key to be encrypted

Returns

a byte value that represents the encrypted key

Return type

bytes

ripemd160(key: Any) bytes

Encrypts a key using RIPEMD-160.

Parameters

key (Any) – the key to be encrypted

Returns

a byte value that represents the encrypted key

Return type

bytes

hash160(key: Any) bytes

Encrypts a key using HASH160.

Parameters

key (Any) – the key to be encrypted

Returns

a byte value that represents the encrypted key

Return type

bytes

hash256(key: Any) bytes

Encrypts a key using HASH256.

Parameters

key (Any) – the key to be encrypted

Returns

a byte value that represents the encrypted key

Return type

bytes

check_sig(pub_key: ECPoint, signature: bytes) bool

Checks the signature for the current script container.

Parameters
  • pub_key (ECPoint) – the public key of the account

  • signature (bytes) – the signature of the current script container

Returns

whether the signature is valid or not

Return type

bool

check_multisig(pubkeys: List[ECPoint], signatures: List[bytes]) bool

Checks the signatures for the current script container.

Parameters
  • pubkeys (List[ECPoint]) – a list of public keys

  • signatures (List[bytes]) – a list of signatures

Returns

a boolean value that represents whether the signatures were validated

Return type

bool

verify_with_ecdsa(message: Any, pubkey: ECPoint, signature: ByteString, curve: NamedCurve) bool

Using the elliptic curve, it checks if the signature of the any item was originally produced by the public key.

Parameters
  • message (Any) – the encrypted message

  • pubkey (ECPoint) – the public key that might have created the item

  • signature (bytes) – the signature of the item

  • curve (NamedCurve) – the curve that will be used by the ecdsa

Returns

a boolean value that represents whether the signature is valid

Return type

bool

murmur32(data: ByteString, seed: int) ByteString

Computes the hash value for the specified byte array using the murmur32 algorithm.

Parameters
  • data (ByteString) – the input to compute the hash code for

  • seed (int) – the seed of the murmur32 hash function

Returns

the hash value

Return type

ByteString