pmac

package
v1.0.4001 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

PMAC message authentication code, defined in http://web.cs.ucdavis.edu/~rogaway/ocb/pmac.pdf

Index

Constants

View Source
const (
	// R is the minimal irreducible polynomial for a 128-bit block size
	R = 0x87
)

Variables

This section is empty.

Functions

func New

func New(c cipher.Block) (hash.Hash, error)

New creates a new PMAC instance using the given cipher

func NewWithTagSize

func NewWithTagSize(c cipher.Block, tagsize int) (hash.Hash, error)

NewWithTagSize returns a hash.Hash computing the PMAC checksum with the given tag size. The tag size must between the 1 and the cipher's block size.

func Sum

func Sum(msg []byte, c cipher.Block, tagsize int) ([]byte, error)

Sum computes the PMAC checksum with the given tagsize of msg using the cipher.Block.

func Verify

func Verify(mac, msg []byte, c cipher.Block, tagsize int) bool

Verify computes the PMAC checksum with the given tagsize of msg and compares it with the given mac. This functions returns true if and only if the given mac is equal to the computed one.

Types

type Block

type Block struct {
	Data []byte

	Size int
}

Block is a 128-bit array used by certain block ciphers (i.e. AES)

func NewBlock

func NewBlock(size int) Block

func (*Block) Clear

func (b *Block) Clear()

Clear zeroes out the contents of the block

func (*Block) Dbl

func (b *Block) Dbl()

Dbl performs a doubling of a block over GF(2^128):

a<<1 if firstbit(a)=0
(a<<1) ⊕ 0¹²⁰10000111 if firstbit(a)=1

func (*Block) Encrypt

func (b *Block) Encrypt(c cipher.Block)

Encrypt a block with the given block cipher

Directories

Path Synopsis
Package aes implements the PMAC MAC with the AES.
Package aes implements the PMAC MAC with the AES.

Jump to

Keyboard shortcuts

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