]> Cypherpunks.ru repositories - gogost.git/blobdiff - gost28147/ctr_test.go
Use more modern Go version
[gogost.git] / gost28147 / ctr_test.go
index 7eace06576693f312f71c4d7c972e3ead1f5c69b..086b450780072063f8d368a58e5baf46f46719fe 100644 (file)
@@ -104,12 +104,12 @@ func TestCTRGCL3Vector(t *testing.T) {
        ctr := c.NewCTR(iv)
        tmp := make([]byte, len(plaintext))
        ctr.XORKeyStream(tmp, plaintext)
-       if bytes.Compare(tmp, ciphertext) != 0 {
+       if !bytes.Equal(tmp, ciphertext) {
                t.Fatal("encryption failed")
        }
        ctr = c.NewCTR(iv)
        ctr.XORKeyStream(tmp, tmp)
-       if bytes.Compare(tmp, plaintext) != 0 {
+       if !bytes.Equal(tmp, plaintext) {
                t.Fatal("decryption failed")
        }
 }
@@ -145,12 +145,12 @@ func TestCTRGCL2Vector(t *testing.T) {
        ctr := c.NewCTR(iv[:])
        tmp := make([]byte, len(plaintext))
        ctr.XORKeyStream(tmp, plaintext)
-       if bytes.Compare(tmp, ciphertext) != 0 {
+       if !bytes.Equal(tmp, ciphertext) {
                t.Fatal("encryption failed")
        }
        ctr = c.NewCTR(iv[:])
        ctr.XORKeyStream(tmp, tmp)
-       if bytes.Compare(tmp, plaintext) != 0 {
+       if !bytes.Equal(tmp, plaintext) {
                t.Fatal("decryption failed")
        }
 }
@@ -166,7 +166,7 @@ func TestCTRRandom(t *testing.T) {
                ctr.XORKeyStream(tmp, pt[:])
                ctr = c.NewCTR(iv[:])
                ctr.XORKeyStream(tmp, tmp)
-               return bytes.Compare(tmp, pt) == 0
+               return bytes.Equal(tmp, pt)
        }
        if err := quick.Check(f, nil); err != nil {
                t.Error(err)