Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Jul 12, 2024
1 parent b22ec3d commit a94b2d1
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lms/lms.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ func (priv *PrivateKey) incrementQ() {
priv.q++
}

// Retrieve the current value of the internal counter, q.
// Used for unit tests
func (priv *PrivateKey) Q() uint32 {
return priv.q
}

// compute authtree
func (priv *PrivateKey) Precompute() {
tree, err := GeneratePKTree(priv.typ, priv.otsType, priv.id, priv.seed)
if err != nil {
return
}

priv.authtree = tree
}

// ToBytes() serialized the private key into a byte string for storage.
// The current value of the internal counter, q, is included.
func (priv *PrivateKey) ToBytes() []byte {
Expand Down Expand Up @@ -184,12 +200,6 @@ func (priv *PrivateKey) ToBytes() []byte {
return serialized
}

// Retrieve the current value of the internal counter, q.
// Used for unit tests
func (priv *PrivateKey) Q() uint32 {
return priv.q
}

// NewPrivateKeyFromBytes returns an PrivateKey that represents b.
// This is the inverse of the ToBytes() method on the PrivateKey object.
func NewPrivateKeyFromBytes(b []byte) (*PrivateKey, error) {
Expand Down

0 comments on commit a94b2d1

Please sign in to comment.