summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2019-07-10 15:55:28 +0300
committerSergey Matveev <stargrave@stargrave.org>2019-07-12 22:50:07 +0300
commit0f9eff2c693f021fd502d5a4f2b98ccc0d3e13c5 (patch)
treedfc01d8e9f5739176eef5a6978c657251db47e5d
parentff0ff768110b9bd69d030a1423bad515ea4c32bb (diff)
downloadpygost-0f9eff2c693f021fd502d5a4f2b98ccc0d3e13c5.tar.xz
Reuse _pos method
-rw-r--r--pygost/gost3410.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/pygost/gost3410.py b/pygost/gost3410.py
index 1167676..f1baa58 100644
--- a/pygost/gost3410.py
+++ b/pygost/gost3410.py
@@ -54,9 +54,7 @@ class GOST3410Curve(object):
self.y = y
r1 = self.y * self.y % self.p
r2 = ((self.x * self.x + self.a) * self.x + self.b) % self.p
- if r2 < 0:
- r2 += self.p
- if r1 != r2:
+ if r1 != self._pos(r2):
raise ValueError("Invalid parameters")
def _pos(self, v):