mac

package
v1.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 6 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 added in v1.3.0

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

ValidateHMACParams validates parameters of HMAC constructor.

Types

type HMAC added in v1.3.0

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

HMAC implementation of interface tink.MAC

func NewHMAC added in v1.3.0

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 added in v1.3.0

func (h *HMAC) ComputeMAC(data []byte) ([]byte, error)

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

func (*HMAC) VerifyMAC added in v1.3.0

func (h *HMAC) VerifyMAC(mac []byte, data []byte) error

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

Jump to

Keyboard shortcuts

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