mkp224o/README.md

144 lines
5.2 KiB
Markdown
Raw Permalink Normal View History

2020-11-24 17:23:21 +01:00
## mkp224o - vanity address generator for ed25519 onion services
2017-09-25 21:22:07 +02:00
2023-12-08 18:32:51 +01:00
This tool generates vanity ed25519 (hidden service version 3[^1][^2],
2020-08-28 18:59:29 +02:00
formely known as proposal 224) onion addresses.
2017-09-25 21:22:07 +02:00
2023-03-27 01:43:49 +02:00
### Requirements for building
2020-07-16 22:33:20 +02:00
2020-08-28 18:59:29 +02:00
* C99 compatible compiler (gcc and clang should work)
* libsodium (including headers)
* GNU make
* GNU autoconf (to generate configure script, needed only if not using release tarball)
* UNIX-like platform (currently tested in Linux and OpenBSD, but should
also build under cygwin and msys2).
2020-07-16 22:33:20 +02:00
For debian-like linux distros, this should be enough to prepare for building:
2017-09-25 21:22:07 +02:00
2020-08-28 18:59:29 +02:00
```bash
apt install gcc libc6-dev libsodium-dev make autoconf
2020-08-28 18:59:29 +02:00
```
2020-07-16 22:33:20 +02:00
2020-11-24 17:23:21 +01:00
### Building
2020-07-16 22:33:20 +02:00
2023-03-27 01:43:49 +02:00
Run `./autogen.sh` to generate a configure script, if there isn't one already.
2020-08-28 18:59:29 +02:00
2023-03-27 01:43:49 +02:00
Run `./configure` to generate a makefile.
On \*BSD platforms you may need to specify extra include/library paths:
2017-10-06 20:05:44 +02:00
`./configure CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"`.
2020-08-28 18:59:29 +02:00
2021-03-09 09:58:46 +01:00
On AMD64 platforms, you probably also want to pass something like
2023-03-27 01:43:49 +02:00
`--enable-amd64-51-30k` to the configure script invocation for faster key generation;
2018-01-10 22:33:37 +01:00
run `./configure --help` to see all available options.
2017-09-25 21:22:07 +02:00
2020-08-28 18:59:29 +02:00
Finally, `make` to start building (`gmake` in \*BSD platforms).
2020-07-16 22:33:20 +02:00
2020-11-24 17:23:21 +01:00
### Usage
2020-07-16 22:33:20 +02:00
2023-03-27 01:43:49 +02:00
mkp224o needs one or more filters to work.
You may specify them as command line arguments,
eg `./mkp224o test`, or load them from file with `-f` switch.
2020-08-28 18:59:29 +02:00
2023-03-27 01:43:49 +02:00
It makes directories with secret/public keys and hostnames
for each discovered service. By default, the working directory is the current
2020-08-28 18:59:29 +02:00
directory, but that can be overridden with `-d` switch.
Use `-s` switch to enable printing of statistics, which may be useful
2017-10-06 20:05:44 +02:00
when benchmarking different ed25519 implementations on your machine.
2017-09-25 21:22:07 +02:00
2020-08-28 18:59:29 +02:00
Use `-h` switch to obtain all available options.
2020-07-16 22:34:43 +02:00
2020-08-28 18:59:29 +02:00
I highly recommend reading [OPTIMISATION.txt][OPTIMISATION] for
performance-related tips.
2020-07-16 22:33:20 +02:00
2020-11-24 17:23:21 +01:00
### FAQ and other useful info
2020-07-16 22:33:20 +02:00
2020-11-24 17:35:55 +01:00
* How do I generate address?
2020-08-28 18:59:29 +02:00
Once compiled, run it like `./mkp224o neko`, and it will try creating
keys for onions starting with "neko" in this example; use `./mkp224o
-d nekokeys neko` to not litter current directory and put all
discovered keys in directory named "nekokeys".
2020-07-16 22:33:20 +02:00
2020-11-24 17:35:55 +01:00
* How do I make tor use generated keys?
2020-08-28 18:59:29 +02:00
Copy key folder (though technically only `hs_ed25519_secret_key` is required)
to where you want your service keys to reside:
2020-07-16 22:33:20 +02:00
2020-08-28 18:59:29 +02:00
```bash
sudo cp -r neko54as6d54....onion /var/lib/tor/nekosvc
```
2020-07-16 22:33:20 +02:00
2020-11-24 17:35:55 +01:00
You may need to adjust ownership and permissions:
2020-07-16 22:33:20 +02:00
2020-08-28 18:59:29 +02:00
```bash
sudo chown -R tor: /var/lib/tor/nekosvc
sudo chmod -R u+rwX,og-rwx /var/lib/tor/nekosvc
```
2020-07-16 22:33:20 +02:00
Then edit `torrc` and add new service with that folder.\
2020-08-28 18:59:29 +02:00
After reload/restart tor should pick it up.
2020-07-16 22:33:20 +02:00
2023-07-26 10:27:45 +02:00
* How to generate addresses with `0-1` and `8-9` digits?
2020-11-24 17:35:55 +01:00
2022-05-12 17:02:09 +02:00
Onion addresses use base32 encoding which does not include `0,1,8,9`
numbers.\
2020-11-24 17:35:55 +01:00
So no, that's not possible to generate these, and mkp224o tries to
2020-08-28 18:59:29 +02:00
detect invalid filters containing them early on.
2020-11-24 17:35:55 +01:00
* How long is it going to take?
2020-08-28 18:59:29 +02:00
Because of probablistic nature of brute force key generation, and
varience of hardware it's going to run on, it's hard to make promisses
about how long it's going to take, especially when the most of users
want just a few keys.\
See [this issue][#27] for very valuable discussion about this.\
2020-08-28 18:59:29 +02:00
If your machine is powerful enough, 6 character prefix shouldn't take
more than few tens of minutes, if using batch mode (read
[OPTIMISATION.txt][OPTIMISATION]) 7 characters can take hours
to days.\
2020-08-28 18:59:29 +02:00
No promisses though, it depends on pure luck.
2020-11-24 17:35:55 +01:00
* Will this work with onionbalance?
2020-08-28 18:59:29 +02:00
It appears that onionbalance supports loading usual
`hs_ed25519_secret_key` key so it should work.
2020-07-16 22:33:20 +02:00
* Is there a docker image?
Yes, if you do not wish to compile mkp224o yourself, you can use
the `ghcr.io/cathugger/mkp224o` image like so:
```bash
docker run --rm -it -v $PWD:/keys ghcr.io/cathugger/mkp224o:master -d /keys neko
```
2020-11-24 17:23:21 +01:00
### Acknowledgements & Legal
2020-08-28 18:59:29 +02:00
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to the
public domain worldwide. This software is distributed without any
warranty.
You should have received a copy of the CC0 Public Domain Dedication
along with this software. If not, see [CC0][].
* `keccak.c` is based on [Keccak-more-compact.c][keccak.c]
* `ed25519/{ref10,amd64-51-30k,amd64-64-24k}` are adopted from
[SUPERCOP][]
* `ed25519/ed25519-donna` adopted from [ed25519-donna][]
* Idea used in `worker_fast()` is stolen from [horse25519][]
* base64 routines and initial YAML processing work contributed by
2020-08-28 21:30:22 +02:00
Alexander Khristoforov (heios at protonmail dot com)
2020-08-28 18:59:29 +02:00
* Passphrase-based generation code and idea used in `worker_batch()`
contributed by [foobar2019][]
[OPTIMISATION]: ./OPTIMISATION.txt
[#27]: https://github.com/cathugger/mkp224o/issues/27
[keccak.c]: https://github.com/XKCP/XKCP/blob/master/Standalone/CompactFIPS202/C/Keccak-more-compact.c
2020-08-29 01:25:24 +02:00
[CC0]: https://creativecommons.org/publicdomain/zero/1.0/
2020-08-28 18:59:29 +02:00
[SUPERCOP]: https://bench.cr.yp.to/supercop.html
[ed25519-donna]: https://github.com/floodyberry/ed25519-donna
[horse25519]: https://github.com/Yawning/horse25519
[foobar2019]: https://github.com/foobar2019
2023-12-08 18:34:42 +01:00
[^1]: https://spec.torproject.org/rend-spec/index.html
[^2]: https://gitlab.torproject.org/tpo/core/torspec/-/raw/main/attic/text_formats/rend-spec-v3.txt