This repo is a showcase of algorithms to get some fun with cryptography.
The scripts are not optimised and are only proof-of-concepts.
-
hacks/brute_force.py : You will find a simple bruteforce algorithm wich test every possibilities to retrieve a private key from the public key.
-
hacks/r_exploit_ecdsa.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 recalculate the private key instantly.
-
hacks/r_exploit_schnorr.py : Same as precedent exploit but for schnorr signatures instead of ecdsa signatures.
-
hacks/substract_optim.py : My best algorithm wich work in 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 which already exist in the pre-generated base.
-
miscellaneous/playground.py : This file contains relations between values of differents signatures for an identical address.
-
miscellaneous/double.py : This file is more about finding an arithmetic relationship between 2 public keys on the curve. Most of formulaes are specific to secp256k1.
- networks/shared-secret.py : Here you will find an algorithm to anonymously contact a node by constructing a route and a global shared secret key that only the initial sender and final receiver will share. The receiver won't know who is the sender and will send a signature to ensure the global key isn't compromised.
- signatures/one-to-one.py : A proof-of-concept to build a signature for a particular public key. Only the owner of this public key will be able to assert that the signature is correct.