slhdsa

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: BSD-3-Clause Imports: 8 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// SLH-DSA-SHA2-128s (Small signatures, Level 1 security)
	SLHDSA128sPublicKeySize  = 32   // bytes
	SLHDSA128sPrivateKeySize = 64   // bytes
	SLHDSA128sSignatureSize  = 7856 // bytes

	// SLH-DSA-SHA2-128f (Fast signing, Level 1 security)
	SLHDSA128fPublicKeySize  = 32    // bytes
	SLHDSA128fPrivateKeySize = 64    // bytes
	SLHDSA128fSignatureSize  = 17088 // bytes

	// SLH-DSA-SHA2-192s (Small signatures, Level 3 security)
	SLHDSA192sPublicKeySize  = 48    // bytes
	SLHDSA192sPrivateKeySize = 96    // bytes
	SLHDSA192sSignatureSize  = 16224 // bytes

	// SLH-DSA-SHA2-192f (Fast signing, Level 3 security)
	SLHDSA192fPublicKeySize  = 48    // bytes
	SLHDSA192fPrivateKeySize = 96    // bytes
	SLHDSA192fSignatureSize  = 35664 // bytes

	// SLH-DSA-SHA2-256s (Small signatures, Level 5 security)
	SLHDSA256sPublicKeySize  = 64    // bytes
	SLHDSA256sPrivateKeySize = 128   // bytes
	SLHDSA256sSignatureSize  = 29792 // bytes

	// SLH-DSA-SHA2-256f (Fast signing, Level 5 security)
	SLHDSA256fPublicKeySize  = 64    // bytes
	SLHDSA256fPrivateKeySize = 128   // bytes
	SLHDSA256fSignatureSize  = 49856 // bytes
)

Security parameters for SLH-DSA (Stateless Hash-Based Digital Signature Algorithm)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedSLHDSA

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

CachedSLHDSA caches intermediate computations

func NewCachedSLHDSA

func NewCachedSLHDSA(privKey *PrivateKey) *CachedSLHDSA

NewCachedSLHDSA creates a cached SLH-DSA instance

func (*CachedSLHDSA) SignWithCache

func (c *CachedSLHDSA) SignWithCache(message []byte) ([]byte, error)

SignWithCache signs using cached computations

type MerkleTree

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

MerkleTree represents an optimized Merkle tree for SLH-DSA

func NewMerkleTree

func NewMerkleTree(height int) *MerkleTree

NewMerkleTree creates a new Merkle tree

func (*MerkleTree) ComputeRoot

func (mt *MerkleTree) ComputeRoot(leaves [][]byte) []byte

ComputeRoot computes the Merkle tree root

type Mode

type Mode int

Mode represents the SLH-DSA parameter set

const (
	SLHDSA128s Mode = iota + 1
	SLHDSA128f
	SLHDSA192s
	SLHDSA192f
	SLHDSA256s
	SLHDSA256f
)

type ParallelSLHDSA

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

ParallelSLHDSA provides parallel signing for multiple messages

func NewParallelSLHDSA

func NewParallelSLHDSA(mode Mode, numKeys, workers int) (*ParallelSLHDSA, error)

NewParallelSLHDSA creates a parallel SLH-DSA processor

func (*ParallelSLHDSA) SignMessages

func (p *ParallelSLHDSA) SignMessages(messages [][]byte) ([][]byte, error)

SignMessages signs multiple messages in parallel

type PrivateKey

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

PrivateKey represents an SLH-DSA private key

func GenerateKey

func GenerateKey(rand io.Reader, mode Mode) (*PrivateKey, error)

GenerateKey generates a new SLH-DSA key pair

func OptimizedGenerateKey

func OptimizedGenerateKey(rand io.Reader, mode Mode) (*PrivateKey, error)

OptimizedGenerateKey generates keys with optimized memory usage

func PrivateKeyFromBytes

func PrivateKeyFromBytes(data []byte, mode Mode) (*PrivateKey, error)

PrivateKeyFromBytes reconstructs a private key from bytes

func (*PrivateKey) Bytes

func (priv *PrivateKey) Bytes() []byte

Bytes returns the private key as bytes

func (*PrivateKey) OptimizedSign

func (priv *PrivateKey) OptimizedSign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error)

OptimizedSign performs signing with buffer pooling

func (*PrivateKey) Sign

func (priv *PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error)

Sign signs a message using the private key

type PublicKey

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

PublicKey represents an SLH-DSA public key

func PublicKeyFromBytes

func PublicKeyFromBytes(data []byte, mode Mode) (*PublicKey, error)

PublicKeyFromBytes reconstructs a public key from bytes

func (*PublicKey) Bytes

func (pub *PublicKey) Bytes() []byte

Bytes returns the public key as bytes

func (*PublicKey) Verify

func (pub *PublicKey) Verify(message, signature []byte, opts crypto.SignerOpts) bool

Verify verifies a signature using the public key

Jump to

Keyboard shortcuts

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