26 lines
362 B
Go
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
|
|
}
|