Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find near matches #50

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

chGoodchild
Copy link

Find near matches

@chGoodchild
Copy link
Author

<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
New best match found (37% similar):
Vanity npub found:         l07rjdpx6dmk64tgf6rrdafq8c8km9xdqsat2d2l4ljjcgy35kkqqw7ysx
Found matching Nostr public key:
Hex public key:   fbfc393426d3776d55684e8636f5203e0f6d94cd043ab5355fafe52c2091a5ac
Hex private key:  78a82249025f3ccb530f36f8f0c6b30dee4706ed534be92e617d87b4bba7fe49
Npub public key:  npub1l07rjdpx6dmk64tgf6rrdafq8c8km9xdqsat2d2l4ljjcgy35kkqqw7ysx
Nsec private key: nsec10z5zyjgztu7vk5c0xmu0p34nphhywphd2d97jtnp0krmfwa8leysqunyzd
Target: c03rad0r
Current: l07rjdpx6dmk64tgf6rrdafq8c8km9xdqsat2d2l4ljjcgy35kkqqw7ysx
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
New best match found (50% similar):a8c72eb9691ad044648fab974557fbe192c9db96b33e9b5a5401bad1818a1221
Vanity npub found:         c03yaqleu7n5v4l6tyqjul28w6mevsxmhclpsr6v6lget9hc20zsj000gd
Found matching Nostr public key:
Hex public key:   c3e24e83f9e7a74657fa59012e7d4776b79640dbbe3e180f4cd7d19596f853c5
Hex private key:  5ebf2949f785869eb106aeadc789d7a7681cf95b707a184036a267aa0b32d87a
Npub public key:  npub1c03yaqleu7n5v4l6tyqjul28w6mevsxmhclpsr6v6lget9hc20zsj000gd
Nsec private key: nsec1t6ljjj0hskrfavgx46ku0zwh5a5pe72mwpapsspk5fn65zejmpaq66ptmc796fde91391f250826
Target: c03rad0r
Current: c03yaqleu7n5v4l6tyqjul28w6mevsxmhclpsr6v6lget9hc20zsj000gd
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
New best match found (62% similar):
Vanity npub found:         c0u2cd0rrlgzt693qzjymkl25dkn6pdwungz8hfqj098hxdhc5ps7zrepv
Found matching Nostr public key:
Hex public key:   c3f8ac35e31fd025e8b100a44ddbeaa36d3d05aee4d023dd2093ca7b99b7c5039399a666de5b180d3
Hex private key:  1e39e516ba824f745a41dc77d184284db972ed522ff4c87a5e8b3d09dc3b3e9c
Npub public key:  npub1c0u2cd0rrlgzt693qzjymkl25dkn6pdwungz8hfqj098hxdhc5ps7zrepv
Nsec private key: nsec1rcu72946sf8hgkjpm3marppgfkuh9m2j9l6vs7j73v7snhpm86wqxm0fet
Target: c03rad0r
Current: c0u2cd0rrlgzt693qzjymkl25dkn6pdwungz8hfqj098hxdhc5ps7zrepv
Non-matc^Cng public key generated: a0c653a9043f098aeca1eb0a639569b2b0691934a98f1eb02bfea25730bc5d65f2fee0d090ae2d0bc9df

@chGoodchild
Copy link
Author

There is probably room for optimization. Rana no longer uses all cores to their full extent

@grunch grunch self-requested a review November 12, 2024 13:48
@grunch
Copy link
Owner

grunch commented Nov 12, 2024

Hi @chGoodchild I like this idea, but the implementation is not giving a good UX IMHO, if I executed rana --vanity-n-prefix=rana,h0dl,n0str and I got this output

Started mining process for vanity bech32 prefix[es]: 'npub1["rana", "h0dl", "n0str"]' (estimated pow: 16)
Benchmarking of cores disabled for vanity npub key upon proper calculation.
Mining using 16 cores...
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
New best match found (25% similar):
Vanity npub found:         r2cr430s6qrq60v4we0ry7a0yhqtru2q9hm2awn63vz5ky0h5yvq95zh5z
Found matching Nostr public key:
Hex public key:   1ab03ac5f0d0060d3d95765e327baf25c0b1f1402df6aeba7a8b054b11f7a118
Hex private key:  0d828339aa418a163cf1fbef96939dce281f9341a55c3b2f875ac6106f02cad9
Npub public key:  npub1r2cr430s6qrq60v4we0ry7a0yhqtru2q9hm2awn63vz5ky0h5yvq95zh5z
Nsec private key: nsec1pkpgxwd2gx9pv083l0hedyuaec5ply6p54wrktu8ttrpqmczetvss6wqra
Target: rana
Current: r2cr430s6qrq60v4we0ry7a0yhqtru2q9hm2awn63vz5ky0h5yvq95zh5z
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>

Here rana got a best match found 25% similar, in a four letter word 25% is just one letter, if we are going to allow a behavior like this we should increase the percent to something over 75%

let's see this one:

New best match found (50% similar):
Vanity npub found:         q9dl6ue0tfxk046asxs7wtlfrx3uvnuuc8dr9vcgy7hpuufkn25qy2lsht
Found matching Nostr public key:
Hex public key:   015bfd732f5a4d67d75d81a1e72fe919a3c64f9cc1da32b30827ae1e71369aa8
Hex private key:  8d700d71db27302d3e4fdfc74aa06b54f1e654d962b031bc3b75c6fd4fc5df4b
Npub public key:  npub1q9dl6ue0tfxk046asxs7wtlfrx3uvnuuc8dr9vcgy7hpuufkn25qy2lsht
Nsec private key: nsec134cq6uwmyucz60j0mlr54grt2nc7v4xev2crr0pmwhr06n79ma9se43j82
Target: h0dl
Current: q9dl6ue0tfxk046asxs7wtlfrx3uvnuuc8dr9vcgy7hpuufkn25qy2lsht

Here rana found 50% similar, word h0ld and it found the last two letters, for a better UX we should only check the first letters instead of the last ones.

@chGoodchild
Copy link
Author

How about something like this?

rana$ cat output.tmp 
Started mining process for vanity bech32 prefix[es]: 'npub1["c03r"]' (estimated pow: 16)
Benchmarking of cores disabled for vanity npub key upon proper calculation.
Mining using 4 cores...
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
Found match with 75.00% similarity:
Vanity npub found:         c03wlses2ya02snndffyf37auqk7jvasvekt776nttw7dlzmm9gq2chl44
Found matching Nostr public key:
Hex public key:   c3e2efc330513af542736a5244c7dde02de933b0666cbf7b535adde6fc5bd950
Hex private key:  ecf20f3bbb30ec030d74ed533b2b35f091037b8d9b2a59f57450f83f0d6c5b24
Npub public key:  npub1c03wlses2ya02snndffyf37auqk7jvasvekt776nttw7dlzmm9gq2chl44
Nsec private key: nsec1aneq7wamxrkqxrt5a4fnk2e47zgsx7udnv49nat52rur7rtvtvjqhltddg
Target:  c03r
Current: c03wlses2ya02snndffyf37auqk7jvasvekt776nttw7dlzmm9gq2chl44
<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
Found exact match!
Vanity npub found:         c03r
Found matching Nostr public key:
Hex public key:   c3e237e9cd970fd7b7c9d6df769530b29b82b449be508131d46533c564b9870b
Hex private key:  07ac4f5a48ccfa49601366bfd971b6362d646ffd7ed3ef022d83702f4fbf8185
Npub public key:  npub1c03r06wdju8a0d7f6m0hd9fsk2dc9dzfheggzvw5v5eu2e9esu9sd5pvvm
Nsec private key: nsec1q7ky7kjgenayjcqnv6lajudkxckkgmla0mf77q3dsdcz7nalsxzsmly65p
1429123 iterations (about 1x10^6 hashes) in 32 seconds. Avg rate 44660 hashes/second

Copy link
Owner

@grunch grunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it works really well, can you please change the output to this:

Target:  n0str
Found match with 80.00% similarity:
Vanity npub found:         n0stjw04hnxmhc4ctxlzt72vqep3c84n34537uul40kxs6fhljqqv735x6
Found matching Nostr public key:
Hex public key:   9be0b939f5bccdbbe2b859be25f94c06431c1eb38d691f739fabec686937fc80
Hex private key:  f5e86007c2e7a769910ea67c300d69adeae4cc7020a3f20a33f287bc9129780e
Npub public key:  npub1n0stjw04hnxmhc4ctxlzt72vqep3c84n34537uul40kxs6fhljqqv735x6
Nsec private key: nsec17h5xqp7zu7nknygw5e7rqrtf4h4wfnrsyz3lyz3n72rmeyff0q8qqmz9fg

I just moved target and removed current

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants