mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-27 12:46:18 +08:00
zuc: refactor the eea test case issue #284
This commit is contained in:
parent
ddb5b69b53
commit
14087e2665
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user