summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLegrandin <gooksankoo@hoiptorrow.mailexpire.com>2012-04-26 22:46:26 +0200
committerLegrandin <gooksankoo@hoiptorrow.mailexpire.com>2012-04-26 22:46:26 +0200
commit8c94c6f5ce5f579e9b896f32bac5dd3ff639fb5c (patch)
tree157225fb58d0330cd60876864b52b212f3c8fdbf
parent7834db2809024536cdfd7fef0b5657dd390bd780 (diff)
downloadpycrypto-8c94c6f5ce5f579e9b896f32bac5dd3ff639fb5c.tar.gz
Fixed two small bugs in ElGamal code.
-rw-r--r--lib/Crypto/PublicKey/ElGamal.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Crypto/PublicKey/ElGamal.py b/lib/Crypto/PublicKey/ElGamal.py
index 1a157ce..99af71c 100644
--- a/lib/Crypto/PublicKey/ElGamal.py
+++ b/lib/Crypto/PublicKey/ElGamal.py
@@ -216,11 +216,11 @@ def construct(tup):
"""
obj=ElGamalobj()
- if len(tuple) not in [3,4]:
+ if len(tup) not in [3,4]:
raise ValueError('argument for construct() wrong length')
- for i in range(len(tuple)):
+ for i in range(len(tup)):
field = obj.keydata[i]
- setattr(obj, field, tuple[i])
+ setattr(obj, field, tup[i])
return obj
class ElGamalobj(pubkey):
@@ -348,7 +348,7 @@ class ElGamalobj(pubkey):
return (a, b)
def _verify(self, M, sig):
- if sig[0]<1 or sig[0]>p-1:
+ if sig[0]<1 or sig[0]>self.p-1:
return 0
v1=pow(self.y, sig[0], self.p)
v1=(v1*pow(sig[0], sig[1], self.p)) % self.p