From d2a726010032f40a97bb478defc34e688f7e35cd Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Sat, 25 Jun 2022 22:52:56 +0300 Subject: [PATCH] Match prefix by a part of a public key The onion domains has PK and checksum + v3. We may match prefix by just PK. Without concatenating the full onion domain. This improves speed of matching --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 9165842..77417b2 100644 --- a/main.go +++ b/main.go @@ -25,10 +25,10 @@ func generate(wg *sync.WaitGroup, prefix string) { publicKey, secretKey, err := ed25519.GenerateKey(nil) checkErr(err) - onionAddress := encodePublicKey(publicKey) - + publicKeyB32 := b32Enc.EncodeToString(publicKey) // If a matching address is found, save key and notify wait group - if strings.HasPrefix(onionAddress, prefix) { + if strings.HasPrefix(publicKeyB32, prefix) { + onionAddress := encodePublicKey(publicKey) fmt.Println(onionAddress) save(onionAddress, publicKey, expandSecretKey(secretKey)) wg.Done()