mac

package
v1.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package mac provides subtle implementations of the Mac primitive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateHmacParams

func ValidateHmacParams(hash string, keySize uint32, tagSize uint32) error

ValidateHmacParams validates parameters of Hmac constructor.

Types

type Hmac

type Hmac struct {
	HashFunc func() hash.Hash
	Key      []byte
	TagSize  uint32
}

Hmac implementation of interface tink.Mac

func NewHmac

func NewHmac(hashAlg string, key []byte, tagSize uint32) (*Hmac, error)

NewHmac creates a new instance of Hmac with the specified key and tag size.

func (*Hmac) ComputeMac

func (h *Hmac) ComputeMac(data []byte) ([]byte, error)

ComputeMac computes message authentication code (MAC) for the given data.

func (*Hmac) VerifyMac

func (h *Hmac) VerifyMac(mac []byte, data []byte) (bool, error)

VerifyMac verifies whether the given MAC is a correct authentication code (MAC) the given data.

Jump to

Keyboard shortcuts

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