mss

package module
v0.0.0-...-f05ec83 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: MIT Imports: 8 Imported by: 0

README

Merkle Signature Scheme

version tag build status

Copyright (c) 2017-2018 LoCCS.
Project to implement the Merkle signature scheme (MSS) based on the W-OTS+.

Contents

Requirement

  • git
  • go 1.9+

are required to compile the library.

Installation

$ go get -u github.com/LoCCS/mss

Usage

Contributing

Kind advices and contributions are always welcomed, but to avoid chaos or destabilizing in existing work, we have processes that bring people in gradually. In general the process is:

  • Find a specific bug you'd like to fix or a specific feature you’d like to add (check out the issues list if to get some ideas)
  • Fix the bug in your own clone and ensure that it's working
  • Submit the change to the master branch via a pull request

Development Resources

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPk

func HashPk(pk *wots.PublicKey) []byte

HashPk computes the hash value for a W-OTS public key

func Verify

func Verify(root []byte, hash []byte, merkleSig *MerkleSig) bool

Verify verifies a Merkle signature

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) Root

func (agent *MerkleAgent) Root() []byte

return the verification root

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

func DeserializeMerkleSig(sigBytes []byte) *MerkleSig

DeserializeMerkleSig the merklesig struct from bytes

func Sign

func Sign(agent *MerkleAgent, hash []byte) (*wots.PrivateKey, *MerkleSig, error)

Sign produces a Merkle signature

func (*MerkleSig) Serialize

func (sig *MerkleSig) Serialize() []byte

Serialize encodes the merklesig

type Node

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

Node is a node in the Merkle tree

func (*Node) String

func (node *Node) String() string

String generates the string representation of node

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

Directories

Path Synopsis
container
ots

Jump to

Keyboard shortcuts

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