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