crypto

package
v0.0.0-...-7cd50c7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 27 Imported by: 8

Documentation

Index

Constants

View Source
const Hspace string = "115792089237316195423570985008687907853269984665640564039457584007913129639936" //2^256

Variables

This section is empty.

Functions

func BLSGetIdDecString

func BLSGetIdDecString(id *BLSId) string

func BLSGetIdDecStringByte

func BLSGetIdDecStringByte(id []byte) string

func BLSIdToBytes

func BLSIdToBytes(id *BLSId) []byte

func BLSKeyGeneration

func BLSKeyGeneration(K, N, num int) ([]byte, [][][]byte, [][][]byte, [][][]byte)

func BLSPubKeyShareFromBytes

func BLSPubKeyShareFromBytes(pubKey_ [][][]byte) ([][]*BLSPubKeyShare, error)

func BLSRecoverSignature

func BLSRecoverSignature(msg []byte, sigShares [][]byte, keyIds [][]byte, t, n int) ([]byte, error)

func BLSSIgnCompare

func BLSSIgnCompare(sig1_, sig2_ []byte) bool

func BLSSigShare

func BLSSigShare(privShare *BLSPrivKeyShare, msg []byte) ([]byte, error)

func BLSSigShareVerification

func BLSSigShareVerification(pubKey *BLSPubKeyShare, msg []byte, sigShare_ []byte) error

func BLSVerifySingature

func BLSVerifySingature(pubKey *BLSPubKey, msg []byte, signature []byte) error

func BytesToStr

func BytesToStr(h []byte) string

func CheckSig

func CheckSig(hash []byte, pk interface{}, sig []byte) error

func ECDSASignatureFromBytes

func ECDSASignatureFromBytes(raw []byte) (*big.Int, *big.Int, error)

func ECDSASignatureToBytes

func ECDSASignatureToBytes(r, s *big.Int) ([]byte, error)

func GenerateECDSAKeyPair

func GenerateECDSAKeyPair() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

func GenerateKeyPair

func GenerateKeyPair() (interface{}, interface{}, error)

func Hash

func Hash(data []byte) []byte

func Init

func Init()

func MerkleHashDigests

func MerkleHashDigests(digests [][]byte) []byte

func ParallelDataArrayHash

func ParallelDataArrayHash(data [][]byte) []byte

func ParseCertPEM

func ParseCertPEM(certFile string) ([]byte, error)

func PrivateKeyFromBytes

func PrivateKeyFromBytes(raw []byte) (interface{}, error)

func PrivateKeyFromFile

func PrivateKeyFromFile(file string) (interface{}, error)

func PrivateKeyFromPEMBlock

func PrivateKeyFromPEMBlock(block *pem.Block) (interface{}, error)

func PrivateKeyToBytes

func PrivateKeyToBytes(pk interface{}) (pkBytes []byte, err error)

func PublicKeyFromBytes

func PublicKeyFromBytes(raw []byte) (interface{}, error)

func PublicKeyFromFile

func PublicKeyFromFile(file string) (interface{}, error)

func PublicKeyToBytes

func PublicKeyToBytes(pk interface{}) (pkBytes []byte, err error)

func Sign

func Sign(hash []byte, sk interface{}) ([]byte, error)

func SignECDSASignature

func SignECDSASignature(sk *ecdsa.PrivateKey, hash []byte) ([]byte, error)

func SrtToBytes

func SrtToBytes(s string) ([]byte, error)

func TBLSKeyGeneration

func TBLSKeyGeneration(t, n int) (*TBLSPubKey, []*TBLSPrivKeyShare)

func TBLSPrivKeyShareΤοBytes

func TBLSPrivKeyShareΤοBytes(priv *TBLSPrivKeyShare) ([]byte, error)

func TBLSPubKeyShareΤοBytes

func TBLSPubKeyShareΤοBytes(pub *TBLSPubKeyShare) ([]byte, error)

func TBLSPubKeyToBytes

func TBLSPubKeyToBytes(pub *TBLSPubKey) ([]byte, error)

func TBLSRecoverSignature

func TBLSRecoverSignature(pubKey *TBLSPubKey, msg []byte, sigShares [][]byte, t, n int) ([]byte, error)

func TBLSSigShare

func TBLSSigShare(privShare *TBLSPrivKeyShare, msg []byte) ([]byte, error)

func TBLSSigShareVerification

func TBLSSigShareVerification(pubKey *TBLSPubKey, msg []byte, sigShare []byte) error

func TBLSVerifySharesAndRecoverSignature

func TBLSVerifySharesAndRecoverSignature(pubKey *TBLSPubKey, msg []byte, sigShares [][]byte, t, n int) ([]byte, error)

func TBLSVerifySingature

func TBLSVerifySingature(pubKey *TBLSPubKey, msg []byte, signature []byte) error

func VerifyECDSASignature

func VerifyECDSASignature(pk *ecdsa.PublicKey, hash []byte, signature []byte) error

Types

type BLSId

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

func BLSIdFromBytes

func BLSIdFromBytes(id_ [][]byte) ([]*BLSId, error)

type BLSPrivKey

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

type BLSPrivKeyShare

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

func BLSPrivKeyShareFromBytes

func BLSPrivKeyShareFromBytes(privKey_ [][]byte) ([]*BLSPrivKeyShare, error)

type BLSPubKey

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

func BLSPubKeyFromBytes

func BLSPubKeyFromBytes(pub_ []byte) (*BLSPubKey, error)

type BLSPubKeyShare

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

type ECDSASignature

type ECDSASignature struct {
	R, S *big.Int
}

type TBLSPrivKey

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

type TBLSPrivKeyShare

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

func TBLSPrivKeyShareFromBytes

func TBLSPrivKeyShareFromBytes(priv []byte) (*TBLSPrivKeyShare, error)

type TBLSPubKey

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

func TBLSPubKeyFromBytes

func TBLSPubKeyFromBytes(pub []byte) (*TBLSPubKey, error)

type TBLSPubKeyShare

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

func TBLSPubKeyShareFromBytes

func TBLSPubKeyShareFromBytes(pub []byte) (*TBLSPubKeyShare, error)

Jump to

Keyboard shortcuts

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