crypto

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: BSD-3-Clause Imports: 7 Imported by: 2

Documentation

Overview

Package crypto provides GPU-accelerated cryptographic operations.

All operations use the unified accel backend selection and fallback to CPU. Backend is selected at runtime via LUX_ACCEL_BACKEND env or auto-detection.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput = errors.New("crypto: invalid input")
	ErrBatchEmpty   = errors.New("crypto: empty batch")
	ErrVerifyFailed = errors.New("crypto: verification failed")
)

Functions

func AggregatePublicKeys

func AggregatePublicKeys(pks [][]byte) ([]byte, error)

AggregatePublicKeys aggregates BLS public keys.

func AggregateSignatures

func AggregateSignatures(sigs [][]byte) ([]byte, error)

AggregateSignatures aggregates BLS signatures.

func BatchVerify

func BatchVerify(sigType SigType, sigs, msgs, pubkeys [][]byte) ([]bool, error)

BatchVerify verifies multiple signatures in parallel. Returns a slice of bools indicating which signatures are valid. Uses GPU acceleration when available, falls back to CPU.

func Hash

func Hash(hashType HashType, inputs [][]byte) ([][32]byte, error)

Hash computes hashes for multiple inputs in parallel.

func MSM

func MSM(curve string, scalars, points [][]byte) ([]byte, error)

MSM performs multi-scalar multiplication on elliptic curves. Used for BLS signature aggregation and other EC operations.

Types

type HashType

type HashType uint8

HashType identifies the hash algorithm.

const (
	HashSHA256 HashType = iota
	HashKeccak256
	HashBlake3
	HashPoseidon
)

type SigType

type SigType uint8

SigType identifies the signature algorithm.

const (
	SigECDSA   SigType = iota // secp256k1
	SigEd25519                // Ed25519
	SigBLS                    // BLS12-381
	SigMLDSA65                // Post-quantum ML-DSA-65
)

Jump to

Keyboard shortcuts

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