hash

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ErrWrongDataSize = internal.Error("wrong data size")

ErrWrongDataSize raised when wrong size of bytes is passed to unmarshal HH.

View Source
const HomomorphicHashSize = 64

HomomorphicHashSize contains size of HH.

Variables

This section is empty.

Functions

func SaltXOR

func SaltXOR(data, salt []byte) (result []byte)

SaltXOR xors bits of data with salt repeating salt if necessary.

Types

type Hash

Hash is implementation of HomomorphicHash.

func Concat

func Concat(hashes []Hash) (Hash, error)

Concat combines hashes based on homomorphic property.

func Sum

func Sum(data []byte) Hash

Sum returns Tillich-Zémor checksum of data.

func (Hash) Bytes

func (h Hash) Bytes() []byte

Bytes represents Hash as bytes.

func (Hash) Empty

func (h Hash) Empty() bool

Empty checks that Hash is empty.

func (Hash) Equal

func (h Hash) Equal(hash Hash) bool

Equal checks that current Hash is equal to passed Hash.

func (Hash) Marshal

func (h Hash) Marshal() ([]byte, error)

Marshal returns bytes representation of Hash.

func (*Hash) MarshalTo

func (h *Hash) MarshalTo(data []byte) (int, error)

MarshalTo tries to marshal Hash into passed bytes and returns count of copied bytes.

func (Hash) ProtoMessage

func (h Hash) ProtoMessage()

ProtoMessage method to satisfy proto.Message interface.

func (*Hash) Reset

func (h *Hash) Reset()

Reset sets current Hash to empty value.

func (Hash) Size

func (h Hash) Size() int

Size returns size of Hash (HomomorphicHashSize).

func (Hash) String

func (h Hash) String() string

String returns string representation of Hash.

func (*Hash) Unmarshal

func (h *Hash) Unmarshal(data []byte) error

Unmarshal tries to parse bytes into valid Hash.

func (Hash) Validate

func (h Hash) Validate(hashes []Hash) bool

Validate checks if combined hashes are equal to current Hash.

func (Hash) Verify

func (h Hash) Verify(data []byte) bool

Verify validates if current hash generated from passed data.

type HashesSlice

type HashesSlice []Hash

HashesSlice is a collection that satisfies sort.Interface and can be sorted by the routines in sort package.

func (HashesSlice) Len

func (hs HashesSlice) Len() int

-- HashesSlice -- an inner type to sort Objects Len is the number of elements in the collection.

func (HashesSlice) Less

func (hs HashesSlice) Less(i, j int) bool

Less reports whether the element with index i should be sorted before the element with index j.

func (HashesSlice) Swap

func (hs HashesSlice) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Jump to

Keyboard shortcuts

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