Convert Figma logo to code with AI

cathugger logomkp224o

vanity address generator for tor onion v3 (ed25519) hidden services

1,204
144
1,204
21

Top Related Projects

GPU-based Onion Hash generator

Quick Overview

The cathugger/mkp224o project is a command-line tool for generating and managing Monero (XMR) subaddresses. It allows users to create, view, and manage multiple Monero subaddresses, which can be useful for privacy and accounting purposes.

Pros

  • Privacy: Monero subaddresses provide an additional layer of privacy by allowing users to generate unique addresses for different transactions, making it harder to link them together.
  • Accounting: The tool makes it easier to manage and keep track of multiple Monero addresses, which can be useful for businesses or individuals who need to separate their finances.
  • Ease of Use: The command-line interface is straightforward and easy to use, even for users who are not familiar with Monero or cryptocurrency in general.
  • Open-Source: The project is open-source, allowing users to review the code, contribute to the project, and ensure the tool's security and reliability.

Cons

  • Limited Functionality: The tool is focused solely on Monero subaddresses and does not provide any additional features or functionality beyond that.
  • Command-Line Only: The tool is a command-line application, which may not be as user-friendly as a graphical user interface (GUI) for some users.
  • Potential Security Risks: As with any cryptocurrency-related tool, there is a risk of security vulnerabilities or potential for misuse, which users should be aware of.
  • Monero-Specific: The tool is designed specifically for Monero and may not be applicable to other cryptocurrencies.

Code Examples

// Generate a new Monero subaddress
let subaddress = mkp224o::generate_subaddress(&master_address, &account_index, &subaddress_index);
println!("New subaddress: {}", subaddress);
// View a list of all subaddresses for a given account
let subaddresses = mkp224o::list_subaddresses(&master_address, &account_index);
for subaddress in subaddresses {
    println!("Subaddress: {}", subaddress);
}
// Derive a Monero subaddress from a master address and indices
let subaddress = mkp224o::derive_subaddress(&master_address, &account_index, &subaddress_index);
println!("Derived subaddress: {}", subaddress);

Getting Started

To get started with the cathugger/mkp224o project, follow these steps:

  1. Install Rust, the programming language used for this project. You can download Rust from the official website: https://www.rust-lang.org/tools/install

  2. Clone the repository from GitHub:

git clone https://github.com/cathugger/mkp224o.git
  1. Navigate to the project directory:
cd mkp224o
  1. Build the project:
cargo build --release
  1. Run the tool with the desired commands. For example, to generate a new Monero subaddress:
./target/release/mkp224o generate --master-address <master_address> --account-index <account_index>

Replace <master_address> and <account_index> with your own values.

  1. Explore the available commands and options by running:
./target/release/mkp224o --help

This will display the list of supported commands and their usage.

Competitor Comparisons

GPU-based Onion Hash generator

Pros of Scallion

  • Written in C#, which may be more accessible for some developers
  • Supports GPU acceleration using OpenCL
  • Can generate vanity addresses for multiple cryptocurrencies (Bitcoin, Litecoin, Dogecoin)

Cons of Scallion

  • Less actively maintained (last commit in 2018)
  • May have lower performance compared to mkp224o for Tor onion address generation
  • Limited to 32-bit systems on Windows

Code Comparison

mkp224o (C):

static inline void filt_prefcmp(const u8 *addr, const u8 *pref, size_t len)
{
	for (size_t i = 0; i < len; ++i)
		if (addr[i] != pref[i])
			return 0;
	return 1;
}

Scallion (C#):

public static bool PrefixMatch(byte[] addr, string prefix)
{
    for (int i = 0; i < prefix.Length; i++)
        if (addr[i] != (byte)prefix[i])
            return false;
    return true;
}

Both projects implement similar functionality for prefix matching, but mkp224o is specifically optimized for Tor onion address generation, while Scallion offers broader cryptocurrency support. mkp224o is more actively maintained and likely provides better performance for Tor-specific use cases.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

mkp224o - vanity address generator for ed25519 onion services

This tool generates vanity ed25519 (hidden service version 312, formely known as proposal 224) onion addresses.

Requirements for building

  • 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).

For debian-like linux distros, this should be enough to prepare for building:

apt install gcc libc6-dev libsodium-dev make autoconf

Building

Run ./autogen.sh to generate a configure script, if there isn't one already.

Run ./configure to generate a makefile. On *BSD platforms you may need to specify extra include/library paths: ./configure CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib".

On AMD64 platforms, you probably also want to pass something like --enable-amd64-51-30k to the configure script invocation for faster key generation; run ./configure --help to see all available options.

Finally, make to start building (gmake in *BSD platforms).

Usage

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.

It makes directories with secret/public keys and hostnames for each discovered service. By default, the working directory is the current directory, but that can be overridden with -d switch.

Use -s switch to enable printing of statistics, which may be useful when benchmarking different ed25519 implementations on your machine.

Use -h switch to obtain all available options.

I highly recommend reading OPTIMISATION.txt for performance-related tips.

FAQ and other useful info

  • How do I generate address?

    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".

  • How do I make tor use generated keys?

    Copy key folder (though technically only hs_ed25519_secret_key is required) to where you want your service keys to reside:

    sudo cp -r neko54as6d54....onion /var/lib/tor/nekosvc
    

    You may need to adjust ownership and permissions:

    sudo chown -R tor: /var/lib/tor/nekosvc
    sudo chmod -R u+rwX,og-rwx /var/lib/tor/nekosvc
    

    Then edit torrc and add new service with that folder.
    After reload/restart tor should pick it up.

  • How to generate addresses with 0-1 and 8-9 digits?

    Onion addresses use base32 encoding which does not include 0,1,8,9 numbers.
    So no, that's not possible to generate these, and mkp224o tries to detect invalid filters containing them early on.

  • How long is it going to take?

    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 for very valuable discussion about this.
    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) 7 characters can take hours to days.
    No promisses though, it depends on pure luck.

  • Will this work with onionbalance?

    It appears that onionbalance supports loading usual hs_ed25519_secret_key key so it should work.

  • 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:

    docker run --rm -it -v $PWD:/keys ghcr.io/cathugger/mkp224o:master -d /keys neko
    

Acknowledgements & Legal

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
  • 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 Alexander Khristoforov (heios at protonmail dot com)
  • Passphrase-based generation code and idea used in worker_batch() contributed by foobar2019

Footnotes

  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