INNER CODE UNIT · Go
NewANSIRetailMAC
emmansun/gmsm · cbcmac/cbcmac.go:137
func NewANSIRetailMAC(creator func(key []byte) (cipher.Block, error), key1, key2 []byte, size int) BlockCipherMAC {
return NewANSIRetailMACWithPadding(creator, key1, key2, size, padding.NewISO9797M2Padding)
}
// NewANSIRetailMACWithPadding creates a new ANSI Retail MAC with padding.
func NewANSIRetailMACWithPadding(creator func(key []byte) (cipher.Block, error), key1, key2 []byte, size int, newPaddingFunc padding.NewPaddingFunc) BlockCipherMAC {
return (*ansiRetailMAC)(NewEMACWithPadding(creator, key1, key2, size, newPaddingFunc).(*emac))
}
// Size returns the MAC value's number of bytes.
// See [github.com/emmansun/gmsm/cbcmac.BlockCipherMAC.Size].
func (e *ansiRetailMAC) Size() int {
return e.size
}
// MAC calculates the MAC of the given data.
// The data is padded with the padding scheme of the block cipher before processing.
// See [github.com/emmansun/gmsm/cbcmac.BlockCipherMAC.MAC].