Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Pollard’s Rho algorithm for discrete logarithm #13656

Open
Labels
enhancementThis PR modified some existing files
@saha2997

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

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /