Documentation ¶
Index ¶
- func HashPk(pk *wots.PublicKey) []byte
- func Verify(root []byte, hash []byte, merkleSig *MerkleSig) bool
- type MerkleAgent
- type MerkleSig
- type Node
- type TreeHashStack
- func (th *TreeHashStack) Init(startingLeaf, h uint32) error
- func (th *TreeHashStack) IsCompleted() bool
- func (th *TreeHashStack) LowestTailHeight() uint32
- func (th *TreeHashStack) Serialize() []byte
- func (th *TreeHashStack) SetLeaf(leaf uint32)
- func (th *TreeHashStack) Top() *Node
- func (th *TreeHashStack) Update(numOp uint32, nodeHouse [][]byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MerkleAgent ¶
type MerkleAgent struct { H uint32 // contains filtered or unexported fields }
MerkleAgent implements a agent working
according to the Merkle signature scheme
func NewMerkleAgent ¶
func NewMerkleAgent(H uint32, seed []byte) (*MerkleAgent, error)
NewMerkleAgent makes a fresh Merkle signing routine
by running the generate key and setup procedure
func RebuildMerkleAgent ¶
func RebuildMerkleAgent(plain []byte, secret []byte) *MerkleAgent
RebuildMerkleAgent restores the merkle agent from serialized bytes and secret bytes
func (*MerkleAgent) Serialize ¶
func (agent *MerkleAgent) Serialize() []byte
Serialize encodes all the information about the merkle tree that can be stored as plaintext
func (*MerkleAgent) SerializeSecretKey ¶
func (agent *MerkleAgent) SerializeSecretKey() []byte
SerializeSecret encodes all the secret data which shall be encrypted
func (*MerkleAgent) Traverse ¶
func (agent *MerkleAgent) Traverse()
Traverse updates both auth path and retained stack for next use
type MerkleSig ¶
type MerkleSig struct { Leaf uint32 LeafPk *wots.PublicKey WtnSig *wots.WinternitzSig Auth [][]byte }
MerkleSig is the container for the signature generated
according to MSS
func DeserializeMerkleSig ¶
DeserializeMerkleSig the merklesig struct from bytes
func Sign ¶
func Sign(agent *MerkleAgent, hash []byte) (*wots.PrivateKey, *MerkleSig, error)
Sign produces a Merkle signature
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a node in the Merkle tree
type TreeHashStack ¶
type TreeHashStack struct {
// contains filtered or unexported fields
}
TreeHashStack is a stack tracing the running state
of the tree hash algo
func NewTreeHashStack ¶
func NewTreeHashStack(startingLeaf, h uint32) *TreeHashStack
NewTreeHashStack makes a new tree hash instance
func RebuildTreeHashStack ¶
func RebuildTreeHashStack(stackBytes []byte) *TreeHashStack
RebuildTreeHashStack restores the TreeHashStack from serialized bytes
func (*TreeHashStack) Init ¶
func (th *TreeHashStack) Init(startingLeaf, h uint32) error
Init initializes the tree hash instance to target specific height
and the range of leaves
func (*TreeHashStack) IsCompleted ¶
func (th *TreeHashStack) IsCompleted() bool
IsCompleted checks if the tree hash instance has completed
func (*TreeHashStack) LowestTailHeight ¶
func (th *TreeHashStack) LowestTailHeight() uint32
LowestTailHeight returns the lowest height of tail nodes
in this tree hash instance
func (*TreeHashStack) Serialize ¶
func (th *TreeHashStack) Serialize() []byte
Serialize encodes the Treehashstack as
+---------------------------------------------------------+ | stackLen||elementSize||element||element||...||element|| +---------------------------------------------------------+
elements are put from bottom to top
func (*TreeHashStack) SetLeaf ¶
func (th *TreeHashStack) SetLeaf(leaf uint32)
func (*TreeHashStack) Top ¶
func (th *TreeHashStack) Top() *Node
Top returns the node in the top of the stack
func (*TreeHashStack) Update ¶
func (th *TreeHashStack) Update(numOp uint32, nodeHouse [][]byte)
Update executes numOp updates on the instance, and
add on the new leaf derived by keyItr if necessary