hash

package
v3.2.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: GPL-3.0 Imports: 10 Imported by: 5

Documentation

Overview

Package hashutil includes all hash-function related helpers for Prysm.

Index

Constants

This section is empty.

Variables

View Source
var ErrNilProto = errors.New("cannot hash a nil protobuf message")

ErrNilProto can occur when attempting to hash a protobuf message that is nil or has nil objects within lists.

Functions

func CustomSHA256Hasher

func CustomSHA256Hasher() func([]byte) [32]byte

CustomSHA256Hasher returns a hash function that uses an enclosed hasher. This is not safe for concurrent use as the same hasher is being called throughout.

Note: that this method is only more performant over hashutil.Hash if the callback is used more than 5 times.

func FastSum256

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

FastSum256 returns a hash sum of the input data using highwayhash. This method is not secure, but may be used as a quick identifier for objects where collisions are acceptable.

func FastSum64

func FastSum64(data []byte) uint64

FastSum64 returns a hash sum of the input data using highwayhash. This method is not secure, but may be used as a quick identifier for objects where collisions are acceptable.

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 HashKeccak256

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

HashKeccak256 defines a function which returns the Keccak-256/SHA3 hash of the data passed in.

func HashProto

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

HashProto hashes a protocol buffer message using sha256.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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