valuehash

package
v0.0.0-...-8c25bd3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: GPL-3.0 Imports: 6 Imported by: 31

Documentation

Overview

Package valuehash provides valuehashes.

Index

Constants

View Source
const (
	SHA256Size int = 32
	SHA512Size int = 64
)

Variables

This section is empty.

Functions

func NewHashFromBytes

func NewHashFromBytes(b []byte) util.Hash

func RandomSHA256

func RandomSHA256() util.Hash

func RandomSHA256WithPrefix

func RandomSHA256WithPrefix(prefix []byte) util.Hash

RandomSHA256WithPrefix generate random hash with string-based prefix. To decode, it's structure is, - <8: length of bytes prefix><8: length of random hash><32: random hash><bytes prefix>

* 52 is max valid length of prefix

func RandomSHA512

func RandomSHA512() util.Hash

func RandomSHA512WithPrefix

func RandomSHA512WithPrefix(prefix []byte) util.Hash

RandomSHA512WithPrefix generate random hash with string-based prefix. To decode, it's structure is, - <8: length of bytes prefix><8: length of random hash><64: random hash><bytes prefix>

* 20 is max valid length of prefix

Types

type Bytes

type Bytes []byte

func NewBytes

func NewBytes(b []byte) Bytes

func NewBytesFromString

func NewBytesFromString(s string) (Bytes, error)

func (Bytes) Bytes

func (h Bytes) Bytes() []byte

func (Bytes) Equal

func (h Bytes) Equal(b util.Hash) bool

func (Bytes) IsValid

func (h Bytes) IsValid([]byte) error

func (Bytes) MarshalText

func (h Bytes) MarshalText() ([]byte, error)

func (Bytes) String

func (h Bytes) String() string

func (*Bytes) UnmarshalText

func (h *Bytes) UnmarshalText(b []byte) error

type HashDecoder

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

func (HashDecoder) Hash

func (d HashDecoder) Hash() util.Hash

func (*HashDecoder) UnmarshalText

func (d *HashDecoder) UnmarshalText(b []byte) error

type L32

type L32 [32]byte

func NewBlake3256

func NewBlake3256(b []byte) L32

func NewSHA256

func NewSHA256(b []byte) L32

func (L32) Bytes

func (h L32) Bytes() []byte

func (L32) Equal

func (h L32) Equal(b util.Hash) bool

func (L32) IsValid

func (h L32) IsValid([]byte) error

func (L32) MarshalText

func (h L32) MarshalText() ([]byte, error)

func (L32) String

func (h L32) String() string

type L64

type L64 [64]byte

func NewSHA512

func NewSHA512(b []byte) L64

func (L64) Bytes

func (h L64) Bytes() []byte

func (L64) Equal

func (h L64) Equal(b util.Hash) bool

func (L64) IsValid

func (h L64) IsValid([]byte) error

func (L64) MarshalText

func (h L64) MarshalText() ([]byte, error)

func (L64) String

func (h L64) String() string

Jump to

Keyboard shortcuts

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