zuc: refactor the eea test case issue #284

This commit is contained in:
Sun Yimin 2024-12-05 08:14:21 +08:00 committed by GitHub
parent ddb5b69b53
commit 14087e2665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -169,14 +169,15 @@ func TestIssue284(t *testing.T) {
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
src := make([]byte, 200) src := make([]byte, RoundBytes*2)
expected := make([]byte, 200) expected := make([]byte, RoundBytes*2)
dst := make([]byte, 200) dst := make([]byte, RoundBytes*2)
c.XORKeyStream(expected, src) c.XORKeyStream(expected, src)
for i := 124; i <= 200; i++ { for i := RoundBytes - 3; i < RoundBytes+5; i++ {
c.XORKeyStreamAt(dst, src[:i], 0) c.XORKeyStreamAt(dst, src[:i], 0)
if !bytes.Equal(expected[:i], dst[:i]) { c.XORKeyStream(dst[i:], src[i:])
if !bytes.Equal(expected, dst) {
t.Fatalf("failed for len %v", i) t.Fatalf("failed for len %v", i)
} }
} }