EC
in package
EC is a wrapper class for Elliptic Curve operations, specifically secp256k1 which is one specifically used for Ethereum. Internally it statically caches EC object, as it's instantiation has high runtime cost.
Tags
Table of Contents
Properties
- $ec : EC
Methods
- EC() : EC
- Returns the underlying cached Elliptic\EC context.
- keyFromPrivate() : KeyPair
- Creates a KeyPair object from a private key.
- Recover() : Address
- Recovers the Ethereum Address from a hash and signature parameters.
- init() : void
- Initializes the Elliptic Curve context. Safe to call multiple times.
Properties
$ec
private
static EC
$ec
Methods
EC()
Returns the underlying cached Elliptic\EC context.
public
static EC() : EC
Return values
EC —The Elliptic\EC context.
keyFromPrivate()
Creates a KeyPair object from a private key.
public
static keyFromPrivate(string $key) : KeyPair
Parameters
- $key : string
-
Hex-encoded private key.
Return values
KeyPair —Elliptic Curve KeyPair.
Recover()
Recovers the Ethereum Address from a hash and signature parameters.
public
static Recover(Hash $hash, OOGmp $r, OOGmp $s, OOGmp $v) : Address
Parameters
- $hash : Hash
-
Hash object to be verified.
- $r : OOGmp
-
The 'r' part of the signature.
- $s : OOGmp
-
The 's' part of the signature.
- $v : OOGmp
-
The 'v' part of the signature.
Tags
Return values
Address —The Ethereum address.
init()
Initializes the Elliptic Curve context. Safe to call multiple times.
private
static init() : void