Experiment in creating .onion names
Computes a valid Tor .onion
hostname and private_key
pair.
Can brute force a specific prefix for the hostname hash if desired.
Tamanegi not designed to be the most performant or featureful, but rather something with code that is easy to compile and understand (as I am only writing it to better understand the topic myself!).
This is an unfinished (but functional) work in progress.
Usage of tamanegi:
-c continuously search for multiple matches
-n num
quit after finding num matches (implies -c)
-output directory
write keys to filesystem directory
-p prefix
search for hashes matching prefix
-t threads
number of simultaneous hashing threads (default $NUM_CPU)
The Tor Wiki has this to say on the subject:
If you decide to run a hidden service Tor generates an RSA-1024 keypair. The .onion name is computed as follows: first the SHA1 hash of the DER-encoded ASN.1 public key is calculated. Afterwards the first half of the hash is encoded to Base32 and the suffix ".onion" is added. Therefore .onion names can only contain the digits 2-7 and the letters a-z and are exactly 16 characters long.
Generating new RSA keys is computationally expensive.
Rather, we generate a RSA keypair and enumerate the public key exponent through all possibilities (odd numbers Emin-Emax) and examine the resulting .onion hash. If a successful partial collision is found, the resulting key is then verified and exported if valid.
This technique is copied from shallot and others.
See also: https://www.thc.org/papers/ffp.html