INNER CODE UNIT · Go
NewCBCRMAC
emmansun/gmsm · cbcmac/cbcmac.go:500
func NewCBCRMAC(b cipher.Block, size int) BlockCipherMAC {
if size <= 0 || size > b.BlockSize() {
panic("cbcmac: invalid size")
}
return &cbcrMAC{b: b, size: size}
}
// Size returns the MAC value's number of bytes.
// See [github.com/emmansun/gmsm/cbcmac.BlockCipherMAC.Size].
func (c *cbcrMAC) Size() int {
return c.size
}
// MAC calculates the MAC of the given data.
// See [github.com/emmansun/gmsm/cbcmac.BlockCipherMAC.MAC].
func (c *cbcrMAC) MAC(src []byte) []byte {
blockSize := c.b.BlockSize()
tag := make([]byte, blockSize)