hmac

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) computation functions.

An HMAC is a cryptographic hash that uses a key to sign a message. The receiver verifies the hash by recomputing it using the same key.

The computed HMAC is represented as an hash.(Imprint).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

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

Hasher is the message authentication computation object.

func New

func New(alg ksihash.Algorithm, key []byte) (h *Hasher, e error)

New returns a new HMAC hash using the given hash.Algorithm type and key.

func (*Hasher) BlockSize

func (h *Hasher) BlockSize() int

BlockSize returns the size of the data block the underlying hash algorithm operates upon in bytes.

func (*Hasher) Imprint

func (h *Hasher) Imprint() (ksihash.Imprint, error)

Imprint returns KSI imprint for the current computation. It does not change the underlying hash state.

func (*Hasher) Reset

func (h *Hasher) Reset()

Reset resets the hasher to its initial state.

func (*Hasher) Size

func (h *Hasher) Size() int

Size return the resulting digest length in bytes.

func (*Hasher) Write

func (h *Hasher) Write(p []byte) (int, error)

Write (via the embedded io.Writer interface) adds more data to the running hash. In case of KsiInvalidArgumentError error (e.g. h is nil) function returns non standard -1 as count of bytes written.

Jump to

Keyboard shortcuts

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