Documentation ¶
Index ¶
- func FromECDSA(priv *ecdsa.PrivateKey) []byte
- func FromECDSAPub(pub *ecdsa.PublicKey) []byte
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func Keccak256Hash(data ...[]byte) []byte
- func LoadECDSAFromString(ecStr string) (*ecdsa.PrivateKey, error)
- func PubkeyToString(pub *ecdsa.PublicKey) (pubStr string)
- func S256() elliptic.Curve
- func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)
- func ToECDSAPub(pub []byte) *ecdsa.PublicKey
- type Signature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromECDSA ¶
func FromECDSA(priv *ecdsa.PrivateKey) []byte
FromECDSA exports a private key into a binary dump.
func FromECDSAPub ¶
FromECDSAPub marshals and returns byte array of ECDSA public key.
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey generates and returns a ECDSA private key.
func Keccak256Hash ¶
Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.
func LoadECDSAFromString ¶
func LoadECDSAFromString(ecStr string) (*ecdsa.PrivateKey, error)
LoadECDSAFromString create ecdsa privatekey from string ecStr should start with 0x or 0X
func PubkeyToString ¶
PubkeyToString returns string of public key, prefix with 0x
func ToECDSA ¶
func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)
ToECDSA creates a private key with the given D value.
func ToECDSAPub ¶
ToECDSAPub create ecdsa.PublicKey object by byte array. Pubkey length derived from ecdsa is 65, with constant prefix 4 in the first byte. So if pubkey length equals 64, we insert one byte in front
Types ¶
type Signature ¶
type Signature struct { R *big.Int // Signature of elliptic curve cryptography. S *big.Int // Signature of elliptic curve cryptography. }
Signature is a wrapper for signed message, and is serializable.
func NewSignature ¶
func NewSignature(privKey *ecdsa.PrivateKey, hash []byte) *Signature
NewSignature sign the specified hash with private key and returns a signature. Panics if failed to sign hash.
Directories ¶
Path | Synopsis |
---|---|
Package secp256k1 wraps the bitcoin secp256k1 C library.
|
Package secp256k1 wraps the bitcoin secp256k1 C library. |
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |