hash

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NilHash sum(nil)
	NilHash = types.HexToHash("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")
	// EmptyUncleHash rlpHash([]*Header(nil))
	EmptyUncleHash = types.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")
)
View Source
var HasherPool = sync.Pool{
	New: func() interface{} { return sha3.NewLegacyKeccak256() },
}

hasherPool holds LegacyKeccak256 hashers for rlpHash.

Functions

func DeriveSha

func DeriveSha(list DerivableList) (h types.Hash)

DeriveSha creates the tree hashes of transactions and receipts in a block header.

func Hash

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

Hash defines a function that returns the sha256 checksum of the data passed in. https://github.com/ethereum/consensus-specs/blob/v0.9.3/specs/core/0_beacon-chain.md#hash

func PrefixedRlpHash

func PrefixedRlpHash(prefix byte, x interface{}) (h types.Hash)

PrefixedRlpHash writes the prefix into the hasher before rlp-encoding x. It's used for typed transactions.

func RlpHash

func RlpHash(x interface{}) (h types.Hash)

Types

type DerivableList

type DerivableList interface {
	Len() int
	EncodeIndex(int, *bytes.Buffer)
}

DerivableList is the input to DeriveSha. It is implemented by the 'Transactions' and 'Receipts' types. This is internal, do not use these methods.

Jump to

Keyboard shortcuts

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