crypto

package
v0.0.0-...-9352369 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

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 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 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