elkrem

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LeftSha

func LeftSha(in chainhash.Hash) chainhash.Hash

func RightSha

func RightSha(in chainhash.Hash) chainhash.Hash

Types

type ElkremNode

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

You can calculate h from i but I can't figure out how without taking O(i) ops. Feels like there should be a clever O(h) way. 1 byte, whatever.

type ElkremReceiver

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

func ElkremReceiverFromBytes

func ElkremReceiverFromBytes(b []byte) (*ElkremReceiver, error)

func (*ElkremReceiver) AddNext

func (e *ElkremReceiver) AddNext(sha *chainhash.Hash) error

AddNext inserts the next hash in the tree. Returns an error if the incoming hash doesn't fit.

func (*ElkremReceiver) AtIndex

func (e *ElkremReceiver) AtIndex(w uint64) (*chainhash.Hash, error)

AtIndex returns the w'th hash in the receiver.

func (*ElkremReceiver) ToBytes

func (e *ElkremReceiver) ToBytes() ([]byte, error)

ToBytes turns the Elkrem Receiver into a bunch of bytes in a slice. first the number of nodes (1 byte), then a series of 41 byte long serialized nodes, which are 1 byte height, 8 byte index, 32 byte hash.

func (*ElkremReceiver) UpTo

func (e *ElkremReceiver) UpTo() uint64

UpTo tells you what the receiver can go up to.

type ElkremSender

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

func NewElkremSender

func NewElkremSender(r chainhash.Hash) *ElkremSender

Creates an Elkrem Sender from a root hash.

func (*ElkremSender) AtIndex

func (e *ElkremSender) AtIndex(w uint64) (*chainhash.Hash, error)

AtIndex skips to the requested index should never error; remove error..?

func (*ElkremSender) ToBytes

func (e *ElkremSender) ToBytes() []byte

ToBytes returns the root of the elkrem sender tree as a byte slice. This function is in place to allow one to export the root of the tree. However, node that if one uses a deterministic procedure to generate the root, then serialization isn't necessary as it can simply be re-derived on the fly.

Jump to

Keyboard shortcuts

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