types

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound  = errors.New("Key not found")
	ErrTypeMismatch = errors.New("Type mismatch")
)

Functions

func BufferRead added in v1.0.0

func BufferRead[THash HashType](buf *bytes.Reader) (res THash, err error)

BufferRead reads the given hash or other supported types from the buffer.

func BufferWrite added in v1.0.0

func BufferWrite[THash HashType](buf *bytes.Buffer, hash THash) error

BufferWrite writes the given hash or other supported types to the buffer.

func HashBytes added in v0.1.3

func HashBytes[TH HashType](value TH) ([]byte, error)

Types

type Hash128

type Hash128 [12]byte

type Hash160

type Hash160 [20]byte

type Hash224

type Hash224 [28]byte

type Hash256

type Hash256 [32]byte

type Hash384

type Hash384 [48]byte

type Hash512

type Hash512 [64]byte

type HashType

type HashType interface {
	Hash128 | Hash160 | Hash224 | Hash256 | Hash384 | Hash512 |
		uint16 | uint32 | uint64 | int16 | int32 | int64 | int | uint | string
}

type Hasher

type Hasher[Key HashType] func(values ...[]byte) Key

type IHash

type IHash[Key HashType] interface {
	Hash() Key
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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