sign

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	M               = 8
	N               = 7
	Dbar            = 48
	B               = 430070539612332.205811372782969  // 2^48.61156663661591
	Bsquare         = "184960669042442604975662780477" // B^2
	Kappa           = 23
	LogN            = 8
	SigmaE          = 6.108187070284607
	BoundE          = SigmaE * 2
	SigmaStar       = 172852667880.2713189548230532887787 // 2^37.33075191469097
	BoundStar       = SigmaStar * 2
	SigmaU          = 163961331.5239387
	BoundU          = SigmaU * 2
	KeySize         = 32              // 256 bits
	Q               = 0x1000000004A01 // 48-bit NTT-friendly prime
	QNu             = 0x80000
	QXi             = 0x40000
	TrustedDealerID = 0
	CombinerID      = 1
	Xi              = 30
	Nu              = 29
	EtaEpsilon      = 2.650104
)

PARAMETERS

Variables

View Source
var Threshold int

Functions

func CheckL2Norm

func CheckL2Norm(r *ring.Ring, Delta structs.Vector[ring.Poly], z structs.Vector[ring.Poly]) bool

CheckL2Norm checks if the L2 norm of the vector of Delta is less than or equal to Bsquare

func FullRankCheck

func FullRankCheck(D structs.Matrix[ring.Poly], r *ring.Ring) bool

FullRankCheck checks if the given matrix is full-rank, ignoring the first column

func Gen

func Gen(r *ring.Ring, r_xi *ring.Ring, uniformSampler *ring.UniformSampler, trustedDealerKey []byte, lagrangeCoefficients structs.Vector[ring.Poly]) (structs.Matrix[ring.Poly], map[int]structs.Vector[ring.Poly], map[int][][]byte, map[int]map[int][]byte, structs.Vector[ring.Poly])

Gen generates the secret shares, seeds, MAC keys, and the public parameter b

func LocalRun

func LocalRun(x int)

main function orchestrates the threshold signature protocol

func Verify

func Verify(r *ring.Ring, r_xi *ring.Ring, r_nu *ring.Ring, z structs.Vector[ring.Poly], A structs.Matrix[ring.Poly], mu string, bTilde structs.Vector[ring.Poly], c ring.Poly, roundedDelta structs.Vector[ring.Poly]) bool

Verify verifies the correctness of the signature. Note: This function does not modify its inputs - it creates copies where needed.

Types

type Party

type Party struct {
	ID             int
	Ring           *ring.Ring
	RingXi         *ring.Ring
	RingNu         *ring.Ring
	UniformSampler *ring.UniformSampler
	SkShare        structs.Vector[ring.Poly]
	Seed           map[int][][]byte
	R              structs.Matrix[ring.Poly]
	C              ring.Poly
	H              structs.Vector[ring.Poly]
	Lambda         ring.Poly
	D              structs.Matrix[ring.Poly]
	MACKeys        map[int][]byte
	MACs           map[int][]byte
}

Party struct holds all state and methods for a party in the protocol

func NewParty

func NewParty(id int, r *ring.Ring, r_xi *ring.Ring, r_nu *ring.Ring, sampler *ring.UniformSampler) *Party

NewParty initializes a new Party instance

func (*Party) SignFinalize

SignFinalize finalizes the signature

func (*Party) SignRound1

func (party *Party) SignRound1(A structs.Matrix[ring.Poly], sid int, PRFKey []byte, T []int) (structs.Matrix[ring.Poly], map[int][]byte)

SignRound1 performs the first round of signing

func (*Party) SignRound2

func (party *Party) SignRound2(A structs.Matrix[ring.Poly], bTilde structs.Vector[ring.Poly], DSum structs.Matrix[ring.Poly], sid int, mu string, T []int, PRFKey []byte, hash []byte) structs.Vector[ring.Poly]

SignRound2 performs the second round of signing

func (*Party) SignRound2Preprocess

func (party *Party) SignRound2Preprocess(A structs.Matrix[ring.Poly], b structs.Vector[ring.Poly], D map[int]structs.Matrix[ring.Poly], MACs map[int]map[int][]byte, sid int, T []int) (bool, structs.Matrix[ring.Poly], []byte)

SignRound2Preprocess verifies the MACs received in round 1 and performs the minimum eigenvalue check

Jump to

Keyboard shortcuts

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