crypto

package
v0.0.0-...-4bf9e1d Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DigestSize = sha512.Size256

DigestSize is the number of bytes in the preferred hash Digest used here.

Variables

This section is empty.

Functions

func NewHash

func NewHash() hash.Hash

NewHash returns a sha512-256 object to do the same operation as Hash()

Types

type Digest

type Digest [DigestSize]byte

Digest represents a 32-byte value holding the 256-bit Hash digest.

func DigestFromString

func DigestFromString(str string) (d Digest, err error)

DigestFromString converts a string to a Digest

func Hash

func Hash(data []byte) Digest

Hash computes the SHASum512_256 hash of an array of bytes

func (*Digest) CanMarshalMsg

func (_ *Digest) CanMarshalMsg(z interface{}) bool

func (*Digest) CanUnmarshalMsg

func (_ *Digest) CanUnmarshalMsg(z interface{}) bool

func (Digest) IsZero

func (d Digest) IsZero() bool

IsZero return true if the digest contains only zeros, false otherwise

func (*Digest) MarshalMsg

func (z *Digest) MarshalMsg(b []byte) (o []byte)

MarshalMsg implements msgp.Marshaler

func (*Digest) MsgIsZero

func (z *Digest) MsgIsZero() bool

MsgIsZero returns whether this is a zero value

func (*Digest) Msgsize

func (z *Digest) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Digest) String

func (d Digest) String() string

String returns the digest in a human-readable Base32 string

func (Digest) ToSlice

func (d Digest) ToSlice() []byte

ToSlice converts Digest to slice, is used by bookkeeping.PaysetCommit

func (Digest) TrimUint64

func (d Digest) TrimUint64() uint64

TrimUint64 returns the top 64 bits of the digest and converts to uint64

func (*Digest) UnmarshalMsg

func (z *Digest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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