mac

package
v1.0.5009 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockCipherFunc

type BlockCipherFunc = func(key []byte) (cipher.Block, error)

BlockCipherFunc is creator func type

type BlockCipherMAC

type BlockCipherMAC interface {
	// Size returns the MAC value's number of bytes.
	Size() int

	// MAC calculates the MAC of the given data.
	// The MAC value's number of bytes is returned by Size.
	// Intercept message authentication code as needed.
	MAC(src []byte) []byte
}

BlockCipherMAC is the interface that wraps the basic MAC method.

func NewANSIRetailMAC

func NewANSIRetailMAC(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC

NewANSIRetailMAC returns an ANSI Retail MAC instance that implements MAC with the given block cipher. The padding scheme is ISO/IEC 9797-1 method 2. GB/T 15821.1-2020 MAC scheme 3

func NewCBCMAC

func NewCBCMAC(b cipher.Block, size int) BlockCipherMAC

NewCBCMAC returns a CBC-MAC instance that implements the MAC with the given block cipher. The padding scheme is ISO/IEC 9797-1 method 2. GB/T 15821.1-2020 MAC scheme 1

func NewCBCRMAC

func NewCBCRMAC(b cipher.Block, size int) BlockCipherMAC

NewCBCRMAC returns a CBCRMAC instance that implements MAC with the given block cipher. GB/T 15821.1-2020 MAC scheme 8

Reference: CBCR: CBC MAC with rotating transformations.

func NewCMAC

func NewCMAC(b cipher.Block, size int) BlockCipherMAC

NewCMAC returns a CMAC instance that implements MAC with the given block cipher. GB/T 15821.1-2020 MAC scheme 5

Reference: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38B.pdf

func NewEMAC

func NewEMAC(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC

NewEMAC returns an EMAC instance that implements MAC with the given block cipher. The padding scheme is ISO/IEC 9797-1 method 2. GB/T 15821.1-2020 MAC scheme 2

func NewLMAC

func NewLMAC(creator BlockCipherFunc, key []byte, size int) BlockCipherMAC

NewLMAC returns an LMAC instance that implements MAC with the given block cipher. GB/T 15821.1-2020 MAC scheme 6

func NewMACDES

func NewMACDES(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC

NewMACDES returns a MAC-DES instance that implements MAC with the given block cipher. The padding scheme is ISO/IEC 9797-1 method 2. GB/T 15821.1-2020 MAC scheme 4

func NewTRCBCMAC

func NewTRCBCMAC(b cipher.Block, size int) BlockCipherMAC

NewTRCBCMAC returns a TR-CBC-MAC instance that implements MAC with the given block cipher. GB/T 15821.1-2020 MAC scheme 7

Reference: TrCBC: Another look at CBC-MAC.

Jump to

Keyboard shortcuts

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