-
-
Notifications
You must be signed in to change notification settings - Fork 49k
Open
Labels
enhancementThis PR modified some existing filesThis PR modified some existing files
Description
Feature description
Description
The repository currently includes pollard_rho.py for integer factorization, but it does not include an implementation for Pollard’s Rho algorithm for discrete logarithm — a related but distinct algorithm used in modular arithmetic and cryptographic computations.
Proposed addition
Add a new file pollard_rho_discrete_log.py under the maths/ directory implementing:
def pollards_rho_discrete_log(g: int, h: int, p: int) -> int:
"""
Returns x such that g^x ≡ h (mod p), using Pollard's Rho discrete logarithm algorithm.
"""
Example
pollards_rho_discrete_log(2, 22, 29)
11
since 2^11 % 29 = 22
Metadata
Metadata
Assignees
Labels
enhancementThis PR modified some existing filesThis PR modified some existing files