Documentation ¶
Index ¶
- Constants
- Variables
- func AKGen(idxPKByte []byte, combinedPKBytes []byte) (*bn256.G2, *big.Int)
- func APKGen(committee []PublicKey, idx []int) *bn256.G2
- func AiGen(listPKBytes []PublicKey, id int) *big.Int
- func B2G1P(bytes []byte) *bn256.G1
- func B2I(bytes []byte) *big.Int
- func CmprG1(pn *bn256.G1) []byte
- func CmprG2(pn *bn256.G2) []byte
- func Combine(sigs [][]byte) ([]byte, error)
- func DecmprG1(bytes []byte) (*bn256.G1, error)
- func DecmprG2(bytes []byte) (*bn256.G2, error)
- func G1P2I(point *bn256.G1) *big.Int
- func Hash4Bls(data []byte) []byte
- func I2Bytes(bn *big.Int, length int) []byte
- func I2G1P(bigInt *big.Int) *bn256.G1
- func KeyGen(seed []byte) (*big.Int, *bn256.G2)
- func New() *memoryCache
- func NewBLSSignatureError(key int, err error) error
- func PKGen(sk *big.Int) *bn256.G2
- func SKGen(seed []byte) *big.Int
- func Sign(data, skBytes []byte, selfIdx int, committee []PublicKey) ([]byte, error)
- func Verify(sig, data []byte, signersIdx []int, committee []PublicKey) (bool, error)
- type BLSSignatureError
- type PublicKey
- type SecretKey
Constants ¶
View Source
const ( // CCmprPnSz Compress point size CCmprPnSz = 32 // CBigIntSz Big Int Byte array size CBigIntSz = 32 // CMaskByte 0b10000000 CMaskByte = 0x80 // CNotMaskB 0b01111111 CNotMaskB = 0x7F // CPKSz Public key size CPKSz = 128 // CSKSz Secret key size CSKSz = 32 )
View Source
const ( // CErr Error prefix CErr = "Details error: " // CErrInps Error input length CErrInps = "Input params error" // CErrCmpr Error when work with (de)compress CErrCmpr = "(De)Compress error" )
View Source
const ( UnExpectedError = iota InvalidPrivateKeyErr InvalidPublicKeyErr InvalidDataSignErr InvalidInputParamsSizeErr InvalidCommitteeInfoErr DecompressFromByteErr MemCacheErr JSONError )
Variables ¶
View Source
var ( // CommonPKs cache list publickey point in an epoch CommonPKs []*bn256.G2 // CommonAPs cache list publickey^a_i point in an epoch CommonAPs []*bn256.G2 // CommonAis cache list a_i integer in an epoch CommonAis []*big.Int )
View Source
var ErrCodeMessage = map[int]struct { Code int Message string }{ UnExpectedError: {-1100, "Unexpected error"}, InvalidPrivateKeyErr: {-1101, "Private key is invalid"}, InvalidPublicKeyErr: {-1102, "Public key is invalid"}, InvalidDataSignErr: {-1103, "Signed data is invalid"}, InvalidCommitteeInfoErr: {-1104, "Committee's info is invalid"}, InvalidInputParamsSizeErr: {-1105, "Len of Input Params is invalid"}, DecompressFromByteErr: {-1106, "Decompress bytes array to Elliptic point error"}, JSONError: {-1107, "JSON Marshal, Unmarshal error"}, MemCacheErr: {-1108, "Memcache error"}, }
Functions ¶
func Hash4Bls ¶
Hash4Bls is Hash function for calculate block hash this is different from hash function for calculate transaction hash
func New ¶
func New() *memoryCache
New returns a wrapped map with all the required database interface methods implemented.
func NewBLSSignatureError ¶
Types ¶
type BLSSignatureError ¶
func (BLSSignatureError) Error ¶
func (e BLSSignatureError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.