crypto

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	HashSize = 32
)

HashSize defines the size of hash

Variables

View Source
var (
	// ZeroHash32B is 32-bytes of all zero
	ZeroHash32B = Hash32B{}
)

Functions

func NewKeyPair

func NewKeyPair() ([]byte, []byte, error)

NewKeyPair wraps ed25519.GenerateKey() for now.

func Sign

func Sign(priv []byte, msg []byte) []byte

Sign wraps ed25519.Sign() for now.

func Verify

func Verify(pub []byte, msg, sig []byte) bool

Verify wraps ed25519.Verify(0 for now.

Types

type Hash32B

type Hash32B [HashSize]byte

Hash32B is 32-byte hash value

type Merkle

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

Merkle tree struct

func NewMerkleTree

func NewMerkleTree(leaves []Hash32B) *Merkle

NewMerkleTree creates a merkle tree given hashed leaves

func (*Merkle) HashTree

func (mk *Merkle) HashTree() Hash32B

HashTree calculates the root hash of a merkle tree

Jump to

Keyboard shortcuts

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