hasher

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HashSize = 32

HashSize is the size of a hash

Variables

View Source
var EmptyHash [HashSize]byte

EmptyHash is the hash value for empty byte array

Functions

func HashData added in v0.2.13

func HashData(hasher Keccak, data []byte) (ha []byte, er error)

HashData hashes the given data and returns its sha3 hash value

func HashFile added in v0.2.13

func HashFile(hasher Keccak, fp string) (ha []byte, er error)

HashFile hashes the given file and returns its sha3 hash value

func HashStream added in v0.2.13

func HashStream(hasher Keccak, reader io.Reader) (ha []byte, er error)

HashStream hashes the given stream and returns its sha3 hash value

func VerifyHash

func VerifyHash(hash []byte) error

VerifyHash verifies the hash value. At the moment, it only verifies the hash size

Types

type Keccak

type Keccak interface {
	hash.Hash
	Read([]byte) (int, error)
}

Keccak wraps sha3.state. In addition to the usual hash methods, it also supports Read to get a variable amount of data from the hash state. Read is faster than Sum because it doesn't copy the internal state, but also modifies the internal state.

func NewKeccak

func NewKeccak() Keccak

NewKeccak creates a new SHA3 Keccak hasher

Jump to

Keyboard shortcuts

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