Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 1.5 KB

README.md

File metadata and controls

21 lines (15 loc) · 1.5 KB

MDH Private Key Finder

This is a basic educational python program based on the Merkle-Diffie-Hellman key exchange. I initially wrote this in C++, but then realised C++ does not handle large numbers so well, so I translated it into Python. This is actually my first Python program.

How it works

Computes the public key (X) by raising the generator to the power of the private key (x) and then performing modulo P (Gx mod P). The program iterates over private keys starting from 0, until a matching public key (public_key = X) is found.

Demonstration

1. Input G (generator)

A_1

2. Input P (modulo)

A_2

3. Input X (public key)

A_3

4. All trial results are printed to the console

A_4

5. We see the corresponding private key of X

A_5