// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2024 Sergey Matveev <stargrave@stargrave.org>
//
// 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
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")
}
}
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")
}
}
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)