Namespace definitions
Cryptographic functions.
Since
0.10.6
Functions
Calculate Ethererum public key from a signature and a hash.
Does almost the same as the Solidity ecrecover(...)
function, but isn't its strict equivalent.
How this function differs from the Solidity one:
takes
rec_id
instead ofv
, whererec_id
=v
- 27other parameters (
r
,s
,hash
) are the same, but in a different orderreturns a 64-byte public key, not a 20-byte address; the address is the last 20 bytes of
keccak256(...)
of the public key
Derives a 20-byte Ethereum address from a 32-byte private key.
Derives a 20-byte Ethereum address from a public key (33, 64, or 65 bytes).
Calculates an Ethereum signature. Takes a hash and a private key and returns values r
, s
, and rec_id
that are accepted by eth_ecrecover
.
Calculates a ECDSA (secp256k1) signature. The returned value can be verified with the verify_signature()
function.
Calculates a Keccak256 hash of a byte array and returns a byte array.
Converts a privkey to a pubkey
Converts a public key between compressed (33-byte) and uncompressed (65-byte) formats.
Extracts the EC point coordinates (x, y) from a public key.
Calculates an SHA-256 hash of a byte array and returns a byte array.
Verifies a signature against a message and public key.
Constructs a public key (compressed or uncompressed) from EC point coordinates.