Documentation ¶
Index ¶
- type BlockCipherFunc
- type BlockCipherMAC
- func NewANSIRetailMAC(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC
- func NewCBCMAC(b cipher.Block, size int) BlockCipherMAC
- func NewCBCRMAC(b cipher.Block, size int) BlockCipherMAC
- func NewCMAC(b cipher.Block, size int) BlockCipherMAC
- func NewEMAC(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC
- func NewLMAC(creator BlockCipherFunc, key []byte, size int) BlockCipherMAC
- func NewMACDES(creator BlockCipherFunc, key1, key2 []byte, size int) BlockCipherMAC
- func NewTRCBCMAC(b cipher.Block, size int) BlockCipherMAC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockCipherFunc ¶
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.