INNER CODE UNIT · Go

shiftLeft

emmansun/gmsm · cbcmac/cbcmac.go:378

func shiftLeft(x []byte) byte {
	var msb byte
	for i := len(x) - 1; i >= 0; i-- {
		msb, x[i] = x[i]>>7, x[i]<<1|msb
	}
	return msb
}

type lmac struct {
	b1, b2 cipher.Block
	pad    padding.Padding
	size   int
}

// NewLMAC returns an LMAC (GB/T 15821.1-2020 MAC scheme 6) instance that
// implements MAC with the given block cipher. The padding scheme is ISO/IEC 9797-1 method 2.
func NewLMAC(creator func(key []byte) (cipher.Block, error), key []byte, size int) BlockCipherMAC {
	return NewLMACWithPadding(creator, key, size, padding.NewISO9797M2Padding)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…