Documentation ¶
Index ¶
- Constants
- func CompressPubkey(pubkey *eddsa.PublicKey) []byte
- func ComputeSecret(privkey *eddsa.PrivateKey, pubkey *eddsa.PublicKey) []byte
- func CreateAddress(b common.Address, nonce uint64) common.Address
- func CreateAddress2(b common.Address, salt [32]byte, inithash []byte) common.Address
- func DecompressPubkey(pubkey []byte) (*eddsa.PublicKey, error)
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func FromEDDSA(priv *eddsa.PrivateKey) []byte
- func FromEDDSAPub(pub *eddsa.PublicKey) []byte
- func GenerateKey(read io.Reader) (*eddsa.PrivateKey, error)
- func HexToEDDSA(hexkey string) (*eddsa.PrivateKey, error)
- func Keccak256(data ...[]byte) []byte
- func Keccak256Hash(data ...[]byte) (h common.Hash)
- func Keccak512(data ...[]byte) []byte
- func LoadEDDSA(file string) (*eddsa.PrivateKey, error)
- func PubkeyToAddress(p eddsa.PublicKey) common.Address
- func SHA3(data ...[]byte) []byte
- func SHA3Hash(data ...[]byte) (h common.Hash)
- func SHA3_512(data ...[]byte) []byte
- func SaveEDDSA(file string, key *eddsa.PrivateKey) error
- func SigToPub(hash, sig []byte) (*eddsa.PublicKey, error)
- func Sign(hash []byte, prv *eddsa.PrivateKey) ([]byte, error)
- func ToEDDSA(d []byte) (*eddsa.PrivateKey, error)
- func ToEDDSAUnsafe(d []byte) *eddsa.PrivateKey
- func UnmarshalPubkey(pub []byte) (*eddsa.PublicKey, error)
- func ValidateSignatureValues(v byte) bool
- func VerifySignature(pub, hash, signature []byte) bool
Constants ¶
const ExtendedSignatureLength = SignatureLength + PubkeyLength
const PrivkeyLength = 57
const PubkeyLength = 57
const SignatureLength = 114
Variables ¶
This section is empty.
Functions ¶
func CompressPubkey ¶
CompressPubkey encodes a public key to the 33-byte compressed format.
func ComputeSecret ¶
func ComputeSecret(privkey *eddsa.PrivateKey, pubkey *eddsa.PublicKey) []byte
func CreateAddress ¶
CreateAddress creates an core address given the bytes and the nonce
func CreateAddress2 ¶
CreateAddress2 creates an core address given the address bytes, initial contract code hash and a salt.
func DecompressPubkey ¶
DecompressPubkey parses a public key in the 33-byte compressed format.
func FromEDDSA ¶
func FromEDDSA(priv *eddsa.PrivateKey) []byte
FromEDDSA exports a private key into a binary dump.
func FromEDDSAPub ¶
func GenerateKey ¶
func GenerateKey(read io.Reader) (*eddsa.PrivateKey, error)
func HexToEDDSA ¶
func HexToEDDSA(hexkey string) (*eddsa.PrivateKey, error)
HexToEDDSA parses a secp256k1 private key.
func Keccak256 ¶
Keccak256 calculates and returns the Keccak256 hash of the input data. //Substituted in CoreCoin by NIPS SHA3-256
func Keccak256Hash ¶
Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.
func LoadEDDSA ¶
func LoadEDDSA(file string) (*eddsa.PrivateKey, error)
LoadEDDSA loads a secp256k1 private key from the given file.
func SHA3Hash ¶ added in v1.0.48
SHA3Hash calculates and returns the NIPS SHA3-256 hash of the input data, converting it to an internal Hash data structure.
func SaveEDDSA ¶
func SaveEDDSA(file string, key *eddsa.PrivateKey) error
SaveEDDSA saves a secp256k1 private key to the given file with restrictive permissions. The key data is saved hex-encoded.
func Sign ¶
func Sign(hash []byte, prv *eddsa.PrivateKey) ([]byte, error)
Sign calculates an EDDSA signature.
This function is susceptible to chosen plaintext attacks that can leak information about the private key that is used for signing. Callers must be aware that the given digest cannot be chosen by an adversery. Common solution is to hash any input before calculating the signature.
The produced signature is in the [R || S || V] format where V is 0 or 1.
func ToEDDSA ¶
func ToEDDSA(d []byte) (*eddsa.PrivateKey, error)
ToEDDSA creates a private key with the given D value.
func ToEDDSAUnsafe ¶
func ToEDDSAUnsafe(d []byte) *eddsa.PrivateKey
ToEDDSAUnsafe blindly converts a binary blob to a private key. It should almost never be used unless you are sure the input is valid and want to avoid hitting errors due to bad origin encoding (0 prefixes cut off).
func UnmarshalPubkey ¶
UnmarshalPubkey converts bytes to a secp256k1 public key.
func ValidateSignatureValues ¶
ValidateSignatureValues verifies whether the signature values are valid with the given chain rules. The v value is assumed to be either 0 or 1.
func VerifySignature ¶
VerifySignature checks that the given public key created signature over hash.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693 and the extendable output function (XOF) BLAKE2Xb.
|
Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693 and the extendable output function (XOF) BLAKE2Xb. |
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
|
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. |
cloudflare
Package bn256 implements a particular bilinear group at the 128-bit security level.
|
Package bn256 implements a particular bilinear group at the 128-bit security level. |
google
Package bn256 implements a particular bilinear group.
|
Package bn256 implements a particular bilinear group. |