X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost28147%2Fcfb_test.go;h=ef491e16564881943494bbd73fa81a5a705b2049;hb=HEAD;hp=43798154912abadf5e40c465246a62a959cc8727;hpb=c40d1e5634cf6d540d908a57423f4b504e39f186;p=gogost.git diff --git a/gost28147/cfb_test.go b/gost28147/cfb_test.go index 4379815..58f4f73 100644 --- a/gost28147/cfb_test.go +++ b/gost28147/cfb_test.go @@ -1,5 +1,5 @@ // GoGOST -- Pure Go GOST cryptographic functions library -// Copyright (C) 2015-2020 Sergey Matveev +// Copyright (C) 2015-2024 Sergey Matveev // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -43,12 +43,12 @@ func TestCFBCryptomanager(t *testing.T) { tmp := make([]byte, 16) fe := c.NewCFBEncrypter(iv) fe.XORKeyStream(tmp, pt) - if bytes.Compare(tmp, ct) != 0 { + if !bytes.Equal(tmp, ct) { t.Fatal("encryption failed") } fd := c.NewCFBDecrypter(iv) fd.XORKeyStream(tmp, ct) - if bytes.Compare(tmp, pt) != 0 { + if !bytes.Equal(tmp, pt) { t.Fatal("decryption failed") } } @@ -65,7 +65,7 @@ func TestCFBRandom(t *testing.T) { fd := c.NewCFBDecrypter(iv[:]) pt2 := make([]byte, len(ct)) fd.XORKeyStream(pt2, ct) - return bytes.Compare(pt2, pt) == 0 + return bytes.Equal(pt2, pt) } if err := quick.Check(f, nil); err != nil { t.Error(err)