Skip to content

Commit

Permalink
Added NewXMSSFromHeight function
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyber committed Jul 9, 2022
1 parent a9ca025 commit c95fbd9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xmss/xmss.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/theQRL/go-qrllib/misc"
"math/rand"
)

type HashFunction uint
Expand Down Expand Up @@ -82,6 +83,12 @@ func NewXMSSFromExtendedSeed(extendedSeed [51]uint8) *XMSS {
return initializeTree(desc, seed)
}

func NewXMSSFromHeight(height uint8, hashFunction HashFunction) *XMSS {
var seed [48]uint8
rand.Read(seed[:])
return NewXMSSFromSeed(seed, height, hashFunction, SHA256_2X)
}

func initializeTree(desc *QRLDescriptor, seed []uint8) *XMSS {
if len(seed) != 48 {
panic("Seed should be 48 bytes. Other values are not currently supported")
Expand Down

0 comments on commit c95fbd9

Please sign in to comment.