]> Cypherpunks.ru repositories - gogost.git/blobdiff - gost3410/public.go
gost3410.PublicKey.Equal method, necessary for Go 1.17
[gogost.git] / gost3410 / public.go
index 79f00f441261a14bfcda14cc417531e4e86c0daa..8642a274bbceb0b19046bcdc72c6062339b2ed81 100644 (file)
@@ -16,6 +16,7 @@
 package gost3410
 
 import (
+       "crypto"
        "fmt"
        "math/big"
 )
@@ -107,3 +108,11 @@ func (pub *PublicKey) VerifyDigest(digest, signature []byte) (bool, error) {
        lm.Mod(lm, pub.C.Q)
        return lm.Cmp(r) == 0, nil
 }
+
+func (our *PublicKey) Equal(theirKey crypto.PublicKey) bool {
+       their, ok := theirKey.(*PublicKey)
+       if !ok {
+               return false
+       }
+       return our.X.Cmp(their.X) == 0 && our.X.Cmp(their.Y) == 0 && our.C.Equal(their.C)
+}