hash

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 8 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMerkleTree

func BuildMerkleTree(hashType string, hashes [][]byte) ([][]byte, error)

BuildMerkleTree take leaf node hash array and build merkle tree

func Get

func Get(hashType crypto.HashType, data []byte) ([]byte, error)

Get return the hash of data by hashType

func GetByStrType

func GetByStrType(hashType string, data []byte) ([]byte, error)

GetByStrType return hash of data by hashType

func GetHashAlgorithm

func GetHashAlgorithm(hashType crypto.HashType) (hash.Hash, error)

GetHashAlgorithm return the corresponding hash interface by hashType

func GetMerklePath added in v2.1.0

func GetMerklePath(index int32, merkleTree [][]byte) [][]byte

func GetMerkleRoot

func GetMerkleRoot(hashType string, hashes [][]byte) ([]byte, error)

GetMerkleRoot used to calculate merkleroot of hashes by hashType

func Prove added in v2.3.3

func Prove(paths [][]byte, merkleRoot, txHash []byte, index uint32, hashType string) bool

Types

type Hash

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

Hash is a wrapper of HashType

func (*Hash) Get

func (h *Hash) Get(data []byte) ([]byte, error)

Get return the hash of data using Hash.hashType

Jump to

Keyboard shortcuts

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