hashutil

package
v0.0.0-...-c85edb6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data []byte) [32]byte

Hash defines a function that returns the Keccak-256/SHA3 hash of the data passed in. https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#appendix

func HashBeaconBlock

func HashBeaconBlock(bb *pb.BeaconBlock) ([32]byte, error)

HashBeaconBlock hashes the full block without the proposer signature. The proposer signature is ignored in order obtain the same block hash used as the "block_root" property in the proposer signature data.

func HashProto

func HashProto(msg proto.Message) ([32]byte, error)

HashProto hashes a protocol buffer message using Keccak-256/SHA3.

func MerkleRoot

func MerkleRoot(values [][]byte) []byte

MerkleRoot derives the merkle root from a 2d byte array with each element in the outer array signifying the data that is to be represented in the merkle tree. Spec:

def merkle_root(values):
	o = [0] * len(values) + values
	for i in range(len(values)-1, 0, -1):
		o[i] = hash(o[i*2] + o[i*2+1])
	return o[1]

func RepeatHash

func RepeatHash(data [32]byte, numTimes uint64) [32]byte

RepeatHash applies the Keccak-256/SHA3 hash function repeatedly numTimes on a [32]byte array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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