Skip to content

Showcase of algorithms to retrieve a private key from a public key on bitcoin.

Notifications You must be signed in to change notification settings

solar559/bitp0wn

 
 

Repository files navigation

Bitp0wn

This repo is a showcase of alogrithms to get a private key from a public key on ecdsa.
The scripts are not optimised and are only proof-of-concepts.  

You can find a little desription of each files below :

  • brute_force.py : You will find a simple brute algorithm wich test every possibilities.

  • birthday.py : This algorithm try to generate new signatures from a prechosen address. This is based on birthday attack.

  • local_maximum.py : Worst heuristic, try to find a local maximum with a bad fitness function.

  • genetic.py : Here we try to crack private key using a metaheuristic (also with a bad fitness function): genetic algorithm. This is much better than local_maximum.py.

  • r_exploit.py : This algorithm exploit a failure in signatures generation. If the same address use the same k in 2 differents signatures (i.e same r-value), then you can retrieve the private key instantly.

  • substract_optim.py : My best algorithm wich work in O(2^(n/2)) or O(sqrt(2^n)) with n the number of bits of the private key. The idea is to generate once for all every public keys with with the private key being inferior to n/2. Then, we multiply them by (n/2) and we substract the public key. We found the private key when we found a key present in the pre-generated base.

Then you can find 2 other files :

  • playground.py : This file contains relations between values of differents signatures for an identical address.

  • double.py : This file is more about finding relationship between 2 public keys on the curve. Most of formulaes are specific to secp256k1.

About

Showcase of algorithms to retrieve a private key from a public key on bitcoin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%