Skip to content

Commit

Permalink
Update ElGamal.py
Browse files Browse the repository at this point in the history
bug for 7680-bit key
  • Loading branch information
serengil authored May 30, 2024
1 parent d24108a commit 7c93ebb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lightphe/cryptosystems/ElGamal.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def generate_keys(self, key_size: int):

# picking a generator g
# g = random.randint(2, int(math.sqrt(p))) # reaches int limit for 3072-bit key
g = int(random.uniform(2, float(decimal.Decimal(p).sqrt())))
# g = int(random.uniform(2, float(decimal.Decimal(p).sqrt())))
g = random.randint(2, int(decimal.Decimal(p).sqrt()))

# picking a private key x
x = random.randint(1, p - 2)
Expand Down

0 comments on commit 7c93ebb

Please sign in to comment.