hashing

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Overview

Package hashing is a generated GoMock package.

Index

Constants

View Source
const (
	HashLen = sha256.Size
	AddrLen = ripemd160.Size
)

Variables

View Source
var ErrInvalidHashLen = errors.New("invalid hash length")

Functions

func 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.

func ComputeHash160

func ComputeHash160(buf []byte) []byte

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

func ComputeHash256

func ComputeHash256(buf []byte) []byte

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

func PubkeyBytesToAddress

func PubkeyBytesToAddress(key []byte) []byte

Types

type Hash160

type Hash160 = [ripemd160.Size]byte

Hash160 A 160 bit long hash value.

func ComputeHash160Array

func ComputeHash160Array(buf []byte) Hash160

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

func ToHash160

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

type Hash256

type Hash256 = [HashLen]byte

Hash256 A 256 bit long hash value.

func ComputeHash256Array

func ComputeHash256Array(buf []byte) Hash256

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

func ToHash256

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

type Hasher added in v1.11.11

type Hasher interface {
	// Hash takes a string and computes its hash value.
	// Values must be computed deterministically.
	Hash([]byte) uint64
}

Hasher is an interface to compute a hash value.

type MockHasher added in v1.11.11

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

MockHasher is a mock of Hasher interface.

func NewMockHasher added in v1.11.11

func NewMockHasher(ctrl *gomock.Controller) *MockHasher

NewMockHasher creates a new mock instance.

func (*MockHasher) EXPECT added in v1.11.11

func (m *MockHasher) EXPECT() *MockHasherMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHasher) Hash added in v1.11.11

func (m *MockHasher) Hash(arg0 []byte) uint64

Hash mocks base method.

type MockHasherMockRecorder added in v1.11.11

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

MockHasherMockRecorder is the mock recorder for MockHasher.

func (*MockHasherMockRecorder) Hash added in v1.11.11

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

Hash indicates an expected call of Hash.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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