Skip to content

Commit

Permalink
Match prefix by a part of a public key
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stokito committed Oct 19, 2023
1 parent 8cc56ec commit d2a7260
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d2a7260

Please # to comment.