highway

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package highwayhash implements the pseudo-random-function (PRF) HighwayHash. HighwayHash is a fast hash function designed to defend hash-flooding attacks or to authenticate short-lived messages.

HighwayHash is not a general purpose cryptographic hash function and does not provide (strong) collision resistance.

Index

Constants

View Source
const (
	// Size is the size of HighwayHash-256 checksum in bytes.
	Size = 32
	// Size128 is the size of HighwayHash-128 checksum in bytes.
	Size128 = 16
)

Variables

This section is empty.

Functions

func Sum

func Sum(data, key []byte) [Size]byte

Sum computes the HighwayHash-256 checksum of data. It panics if the key is not 32 bytes long.

func Sum128

func Sum128(data, key []byte) [Size128]byte

Sum128 computes the HighwayHash-128 checksum of data. It panics if the key is not 32 bytes long.

Types

type Digest

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

func New

func New(key [Size]byte) *Digest

New returns a hash.Hash computing the HighwayHash-256 checksum. It returns a non-nil error if the key is not 32 bytes long.

func New128

func New128(key [Size]byte) *Digest

New128 returns a hash.Hash computing the HighwayHash-128 checksum. It returns a non-nil error if the key is not 32 bytes long.

func (*Digest) BlockSize

func (d *Digest) BlockSize() int

func (*Digest) Reset

func (d *Digest) Reset()

func (*Digest) Size

func (d *Digest) Size() int

func (*Digest) Sum

func (d *Digest) Sum(b []byte) []byte

func (*Digest) Write

func (d *Digest) Write(p []byte) (n int, err error)

func (*Digest) WriteString

func (d *Digest) WriteString(str string) (int, error)

Jump to

Keyboard shortcuts

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