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: boa3.builtin.type.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[boa3.builtin.type.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: boa3.builtin.type.ECPoint, signature: Union[bytes, str], curve: boa3.neo3.contracts.namedcurve.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