X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gost3410%2Fcurve.go;h=1aa783c98e9e452f96e972ecb288aafce07a8f3b;hb=1f39571735eb79ebbb00b2da605cea1a68e3596b;hp=9ec14ded1de85e6760d63f3f7cfb9f7b965eaeab;hpb=3d1de73efc9f6fcc9460da7f7030043fdecfebd9;p=gogost.git diff --git a/gost3410/curve.go b/gost3410/curve.go index 9ec14de..1aa783c 100644 --- a/gost3410/curve.go +++ b/gost3410/curve.go @@ -159,3 +159,15 @@ func (c *Curve) Exp(degree, xS, yS *big.Int) (*big.Int, *big.Int, error) { } return tx, ty, nil } + +func (our *Curve) Equal(their *Curve) bool { + return our.P.Cmp(their.P) == 0 && + our.Q.Cmp(their.Q) == 0 && + our.A.Cmp(their.A) == 0 && + our.B.Cmp(their.B) == 0 && + our.X.Cmp(their.X) == 0 && + our.Y.Cmp(their.Y) == 0 && + ((our.E == nil && their.E == nil) || our.E.Cmp(their.E) == 0) && + ((our.D == nil && their.D == nil) || our.D.Cmp(their.D) == 0) && + our.Co.Cmp(their.Co) == 0 +}