dissertation-2-code/mocks/mac.go
Jake Hillion c7e8c64751
Some checks failed
continuous-integration/drone/push Build is failing
correct udp flow tests
2021-05-13 22:11:07 +01:00

26 lines
362 B
Go

package mocks
import (
"mpbl3p/shared"
)
type AlmostUselessMac string
func (a AlmostUselessMac) CodeLength() int {
return len(a)
}
func (a AlmostUselessMac) Generate([]byte) []byte {
return []byte(a)
}
func (a AlmostUselessMac) Verify(_, sum []byte) error {
for i, c := range sum {
if a[i] != c {
return shared.ErrBadChecksum
}
}
return nil
}