crypto¶
- class NamedCurve(value)¶
Bases:
enum.IntFlag
Represents the named curve used in ECDSA.
- SECP256K1¶
The secp256k1 curve.
- SECP256R1¶
The secp256r1 curve, which known as prime256v1 or nistP-256.
- 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
- 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
- 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
- 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
- check_sig(pub_key: boa3.builtin.type.ECPoint, signature: bytes) → bool¶
Checks the signature for the current script container.
- check_multisig(pubkeys: List[boa3.builtin.type.ECPoint], signatures: List[bytes]) → bool¶
Checks the signatures for the current script container.
- verify_with_ecdsa(message: bytes, pubkey: boa3.builtin.type.ECPoint, signature: bytes, curve: boa3.internal.neo3.contracts.namedcurve.NamedCurve) → bool¶
Using the elliptic curve, it checks if the signature of the message was originally produced by the public key.
- Parameters
message (bytes) – 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