Source File
cbc_mac.go
Belonging Package
github.com/hirochachacha/go-smb2/internal/crypto/ccm
package ccmimport ()// CBC-MAC implementationtype mac struct {ci []bytep intc cipher.Block}func newMAC( cipher.Block) *mac {return &mac{c: ,ci: make([]byte, .BlockSize()),}}func ( *mac) () {for := range .ci {.ci[] = 0}.p = 0}func ( *mac) ( []byte) ( int, error) {for , := range {if .p >= len(.ci) {.c.Encrypt(.ci, .ci).p = 0}.ci[.p] ^=.p++}return len(), nil}// PadZero emulates zero byte padding.func ( *mac) () {if .p != 0 {.c.Encrypt(.ci, .ci).p = 0}}func ( *mac) ( []byte) []byte {return append(, .ci...)}func ( *mac) () int { return len(.ci) }func ( *mac) () int { return 16 }
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |