Skip to content

Commit

Permalink
main: Define a command-line interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cvengler committed Feb 13, 2024
1 parent 463a1c6 commit 1a0ddf4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ Brute-force vanity onion addresses.
## About

*curvy* is a tool very similar [mkp224o](https://github.com/cathugger/mkp224o).
It is currently in a very early stage and does not even offer a public
command line interface, nor a way to export the brute-forced secret key.
This is open space however, so please stay tuned! 🪐

Keep in mind that this is probably not the best tool for this task,
because it is written in a slow(er) language, as well as it ignoring the
advice for searching for vanity addresses given in the specification.

## Usage

```
$ curvy --prefix="foo" --output="./hs_ed25519_secret_key" --threads=64
foob64oywfdxkr4mxxio4xis6lba2peoplvj64kqbpybd2n6sqq6joqd.onion
```

## TODO

* [ ] Offer a command-line interface
* [ ] Store the exported key
* [ ] Rewrite this in a language that natively supports threads
* [ ] Rewrite this in a language that natively supports threads and erases secret keys securely
20 changes: 13 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import (
"crypto/ed25519"
"crypto/sha512"
"encoding/base32"
"encoding/hex"
"flag"
"fmt"
"golang.org/x/crypto/sha3"
"log"
"os"
"strings"
)

const PREFIX = "foo"
const NGOROUTINES = 64
const securePerm = 0600 // equals "rw-------"

var skPrefix = []byte{
Expand Down Expand Up @@ -84,14 +82,22 @@ func worker(prefix string, ch chan ed25519.PrivateKey) {
}

func main() {
ch := make(chan ed25519.PrivateKey)
prefix := flag.String("prefix", "", "the prefix of the onion address")
goroutines := flag.Uint("threads", 8, "the amount of coroutines to use for parallelization")
output := flag.String("output", "./hs_ed25519_secret_key", "the file to store the secret key in")
flag.Parse()

for i := 0; i < NGOROUTINES; i++ {
go worker(PREFIX, ch)
ch := make(chan ed25519.PrivateKey)
for i := uint(0); i < *goroutines; i++ {
go worker(*prefix, ch)
}

sk := <-ch
pk := sk.Public().(ed25519.PublicKey)
fmt.Println(onionAddress(pk))
fmt.Println(hex.EncodeToString(sk))

err := exportSK(sk, *output)
if err != nil {
panic(err)
}
}

0 comments on commit 1a0ddf4

Please sign in to comment.