thrasosc / MDH-Private-Key-Finder

Educational Merkle-Diffie-Hellman key exchange private key finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Educational Merkle-Diffie-Hellman key exchange private key finder

License:MIT License


Languages

Language:Python 100.0%