1 ---------------------------------------------------------------------
3 ---------------------------------------------------------------------
9 CHANGELOG - lists the latest improvements/fixes
10 LICENSE - for those who believe in copyright
11 configure - configures shallot for your system
12 Makefile - builds the binary (on most systems)
13 README - the file you are reading right now
16 shallot.c - computes customized hashes and keys
17 config.h - holds the current configure output
22 This program is based on Bebop's program, onionhash-0.0.2. Since
23 Bebop has mysteriously disappeared (along with his hidden service
24 site), I decided to branch the source and improve upon it further
25 (see CHANGELOG). However, I owe much of the credit to Bebop for
26 the original onionhash, as shallot would not exist without it.
31 * You need to have a recent version of OpenSSL installed.
32 * Type "make" and pray. (configure script coming soon?)
33 * Run the program, get some runts. Come back next month.
38 This program allows you to create customized SHA1 hashes for Tor
39 hidden services. It's based on THC's Fuzzy Fingerprint technique
40 (paper available at http://thc.org/papers/ffp.pdf). "Customized"
41 means, you can choose parts of the hash to match certain regular
44 >> example: create private key for test*.onion:
47 Usage: shallot pattern
48 base32 alphabet allows letters [a-z] and digits [2-7]
49 pattern can be a POSIX-style regular expression, e.g.
50 xxx must contain 'xxx'
51 bar$ must end with 'bar'
52 ^foo must begin with 'foo'
53 b[a4]r may contain leetspeech ;)
54 ^ab|^cd must begin with 'ab' or 'cd'
55 [a-z]{16} must contain letters only, no digits
56 ^dusk.*dawn$ must begin with 'dusk' and end with 'dawn'
59 ----------------------------------------------------------------
60 Found matching pattern after 99133 tries: testvztz3tfoiofv.onion
61 ----------------------------------------------------------------
62 -----BEGIN RSA PRIVATE KEY-----
63 MIICXgIBAAKBgQC3R85m6NQaA1ZjaYqvz1hvFIjbL4RtKdJbG8hlC9xEBkvfr/BG
64 8Z5vDiUzdbDt8mEBuZUDanx80uGJvbXTgmczX0UlkEOgGiZ8RKpnsbKaf/EJNrIw
65 T7MSXQmWNcm22nDeViV7fwy+Usyal2RE5cdVCFsPtEbVZqCumlKkEgCyFwIDBAZ7
66 AoGBAJSa2cGuru/XhzJAEAIwHZbgPDnum9T/srOYxUKW6afHZeOu5S4Cclwb+xb/
67 pGOtzn71XZfCKMfiVdxB/f3XTcRrYB2VnBoNToTD7WfH6DksdDf4zunqiEjvxi9K
68 R+tKhxmF7OedrRt8wIhUmFd1E2Q9nbTHI6icdB4kR4QkYKZzAkEA5M6samK7+495
69 6SWpRXiePIs7sHKWuxdCrG7kW5RNJrv2CcGYwK46TPcaXBcRfM4eq9+9PGoKi0IO
70 gSpOZ5vRYQJBAM0QAZYTZ6ApD014x372MX1ZNofuYL/+XF8ZPZV6Sh4+9MUBuNPb
71 yL7BENDr6pX4Zm6OepvAphhCa4vGno2pHncCQQCQnfhUCHANU4bjtX4EOoI63WDq
72 UwBOeIWxu0YvGt7Z25Dg9CNz/aX8UZIoj6VyKxLRbR9+K3mNrNgaopW+ZDKzAkEA
73 ttgTK1ALe+3v+5H+Ez1SvFPREDFcHihrfD1Ipc5zicY9ixTArgdyZvk+Pi+AMBVV
74 sL2HWvjRLEAgRclvKfkwWwJAFtM+BIGRM5me+fMALuBBEtKnbJ6maflsyucErEb0
75 pIIBkovF5oyWO3lSBmtStJIANNkHOg8aXqjcgPKusDN7CQ==
76 -----END RSA PRIVATE KEY-----
78 The generated key can now be saved as file 'private_key' in your
79 HiddenServiceDir. Afterwards reload Tor (e.g. by sending SIGHUP)
80 and you should be reachable as testvztz3tfoiofv.onion.
85 Shallot generates a lot of keys in a non-standard fashion, by varying
86 e. While some may debate that this leads to weaker keys, all sanity
87 checks found in PKCS#1 v2.1 are strictly followed, so I don't worry
88 too much. Please feel free to disagree with me.
93 First of all, you cannot create any hash you want (in adequate time).
94 If you could easily find collisions on the first half (80 bit) of the
95 SHA1 hash, Torland would be in serious trouble.
97 The speed of the worker() loop can be divided in:
98 +----------------------------------------+
99 | function(s) | CPU consumption |
100 |----------------------+-----------------|
101 | compute next RSA key | 4.6% |
102 | PEM-encode RSA key | 59.4% |
103 | compute SHA1 hash | 30.6% |
104 | BASE32-encode hash | 2.7% |
105 | compare with regex | 2.7% |
106 +----------------------------------------+
108 On a 1.8GHz x86-machine, Bebop got about 250k hashes per second,
109 but on my 1.8GHz x86-machine, I only get about 220k hashes/sec.
110 +---------------------------------------------+
111 | chars | ~number of tries | ~time @ 250 KH/s |
112 |-------+------------------+------------------|
113 | 1 | 32^1 = 32 | <1 sec |
114 | 2 | 32^2 = 1k | <1 sec |
115 | 3 | 32^3 = 32k | <1 sec |
116 | 4 | 32^4 = 1m | 4 sec |
117 | 5 | 32^5 = 32m | 2 min |
118 | 6 | 32^6 = 1g | 1 hour |
119 | 7 | 32^7 = 32g | 2 days |
120 | 8 | 23^8 = 1t | 50 days |
121 | 9 | 32^9 = 32t | 5 years |
122 | 16 | 32^16 = 1y | too long |
123 +---------------------------------------------+
124 Note: you can speed it up if you're only interested in a certain
125 string to appear somewhere, instead of at a fixed position
126 like the beginning of the hash. Also you could make use of
127 'leetspeech', therefore allowing both, e.g. [3e] or [7t]
132 Let me know! If there are any, it's probably in the Linux port.
137 * use something faster than OpenSSL's i2d_RSAPublicKey() for PEM-encoding
138 * lots and lots of command line options (flags) so you can fine tune
139 * support hardware acceleration (e.g. VIA Padlock's hardware SHA-1)
140 * make sure the requested hash contains base32 chars (2-7, a-z) only
141 * make sure the requested hash is valid (not longer that 16 chars)