Skip to content

Commit d2a7260

Browse files
committed
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
1 parent 8cc56ec commit d2a7260

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ func generate(wg *sync.WaitGroup, prefix string) {
2525
publicKey, secretKey, err := ed25519.GenerateKey(nil)
2626
checkErr(err)
2727

28-
onionAddress := encodePublicKey(publicKey)
29-
28+
publicKeyB32 := b32Enc.EncodeToString(publicKey)
3029
// If a matching address is found, save key and notify wait group
31-
if strings.HasPrefix(onionAddress, prefix) {
30+
if strings.HasPrefix(publicKeyB32, prefix) {
31+
onionAddress := encodePublicKey(publicKey)
3232
fmt.Println(onionAddress)
3333
save(onionAddress, publicKey, expandSecretKey(secretKey))
3434
wg.Done()

0 commit comments

Comments
 (0)