This method is tested on Debian and EndeavourOS. The Debian method will be shown here. The only major difference is the package manager. Doing this on the server that hosts the hidden service is NOT needed. You can just transfer over the key in the end.
Requirements: A hosted hidden service, build packages installed:
# apt install gcc libc6-dev libsodium-dev make autoconf git -y
Step 1: Clone the mkp224o GitHub repository.
# git clone https://github.com/cathugger/mkp224o.git
Step 2: Navigate into the directory of the repository with "cd".
Step 3: Build from source.
# ./autogen.sh
# ./configure
# make
Step 4: Generate the keys and vanity addess:
# ./mkp224o test -v -n 1 -d ~/ONION -t 4
What does this command do exactly? Parameter explanation:
test: This is the string you are trying to include at the beginning of your .onion address.
-v: This flag is for verbose output, which provides you with more details during the generation process.
-n 1: This option specifies that you only want to generate 1 matching address.
-d ~/ONION: This parameter specifies the directory where the generated keys should be saved. In this case, it is "~/ONION".
-t 4: This specifies the number of CPU threads to use for the generation.
Make sure to change these options to your situation.
How long will it take?
For a v3 onion address, each character is part of a 32-character Base32-encoded string.
These are estimated times for a consumer CPU, using 4 threads:
1-3 characters: Almost instant to a few seconds.
4 characters: Up to a few minutes.
5 characters: Up to a few minutes.
6 characters: 5 hours to 3 days.
7 characters: Several weeks to months.
8 characters or more: Don't.
Due to the random nature of the process, matches may sometimes be found faster or slower than expected.
Step 5: Use your onion address and its keys:
To do that, you should first remove your old host and key files from "/var/lib/tor/hidden_service".
After that copy your new host file and keys to "/var/lib/tor/hidden_service".
Then, restart TOR:
# systemctl restart tor
You should now be able to access your hidden service with your newly generated onion address.