Jake Hillion
ff4ce07b05
All checks were successful
continuous-integration/drone/push Build is passing
23 lines
398 B
Go
23 lines
398 B
Go
package mocks
|
|
|
|
import (
|
|
"mpbl3p/shared"
|
|
)
|
|
|
|
type AlmostUselessMac struct{}
|
|
|
|
func (AlmostUselessMac) CodeLength() int {
|
|
return 4
|
|
}
|
|
|
|
func (AlmostUselessMac) Generate([]byte) []byte {
|
|
return []byte{'a', 'b', 'c', 'd'}
|
|
}
|
|
|
|
func (u AlmostUselessMac) Verify(_, sum []byte) error {
|
|
if !(sum[0] == 'a' && sum[1] == 'b' && sum[2] == 'c' && sum[3] == 'd') {
|
|
return shared.ErrBadChecksum
|
|
}
|
|
return nil
|
|
}
|