bls_signatures

package
v0.0.0-...-6dabe94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePointG1

func DecodePointG1(s string) (*bls12381.PointG1, error)

func EncodePointG1

func EncodePointG1(p *bls12381.PointG1) string

func G1Generator

func G1Generator() *bls12381.PointG1

Types

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

func DeriveChildSk

func DeriveChildSk(parentSk PrivateKey, index int) PrivateKey

DeriveChildSk python-impl: def derive_child_sk(parent_sk: PrivateKey, index: int) -> PrivateKey:

"""
Derives a hardened EIP-2333 child private key, from a parent private key,
at the specified index.
"""
lamport_pk = parent_sk_to_lamport_pk(parent_sk, index)
return key_gen(lamport_pk)

func KeyGen

func KeyGen(seed []byte) PrivateKey

KeyGen python-impl: def key_gen(seed: bytes) -> PrivateKey:

# KeyGen
# 1. PRK = HKDF-Extract("BLS-SIG-KEYGEN-SALT-", IKM || I2OSP(0, 1))
# 2. OKM = HKDF-Expand(PRK, keyInfo || I2OSP(L, 2), L)
# 3. SK = OS2IP(OKM) mod r
# 4. return SK

L = 48
# `ceil((3 * ceil(log2(r))) / 16)`, where `r` is the order of the BLS 12-381 curve
okm = extract_expand(L, seed + bytes([0]), b"BLS-SIG-KEYGEN-SALT-", bytes([0, L]))
return PrivateKey(int.from_bytes(okm, "big") % default_ec.n)

func (PrivateKey) Bytes

func (pk PrivateKey) Bytes() []byte

func (PrivateKey) GetG1

func (pk PrivateKey) GetG1() *bls12381.PointG1

GetG1 python-impl: def get_g1(self):

return self.value * G1Generator()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL