Run NodesReferenceutils

hashing

Package hashing is a generated GoMock package.

import "github.com/luxfi/node/utils/hashing"

Package hashing is a generated GoMock package.

Functions

Checksum

func Checksum(bytes []byte, length int) []byte

Checksum creates a checksum of [length] bytes from the 256 bit hash of the byte slice.

Returns: the lower [length] bytes of the hash Panics if length > 32.

ComputeHash160

func ComputeHash160(buf []byte) []byte

ComputeHash160 computes a cryptographically strong 160 bit hash of the input byte slice.

ComputeHash256

func ComputeHash256(buf []byte) []byte

ComputeHash256 computes a cryptographically strong 256 bit hash of the input byte slice.

PubkeyBytesToAddress

func PubkeyBytesToAddress(key []byte) []byte

PubkeyBytesToAddress converts a public key to an address using Bitcoin-style SHA256+RIPEMD160 hash.

Types

Hash160

Hash160 A 160 bit long hash value.

func ComputeHash160Array(buf []byte) Hash160
func ToHash160(bytes []byte) (Hash160, error)

Hash256

Hash256 A 256 bit long hash value.

func ComputeHash256Array(buf []byte) Hash256
func ToHash256(bytes []byte) (Hash256, error)

Hasher

Hasher is an interface to compute a hash value.

MockHasher

MockHasher is a mock of Hasher interface.

func NewMockHasher(ctrl *gomock.Controller) *MockHasher
func (m *MockHasher) EXPECT() *MockHasherMockRecorder
func (m *MockHasher) Hash(arg0 []byte) uint64

MockHasherMockRecorder

MockHasherMockRecorder is the mock recorder for MockHasher.

func (mr *MockHasherMockRecorder) Hash(arg0 any) *gomock.Call