You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A command-line vanity (public) key generator for [WireGuard](https://www.wireguard.com/). It only matches the prefix of generated public keys, and not whether the search matches anywhere in the public key. The concept is based on [wireguard-vanity-address](https://github.com/warner/wireguard-vanity-address), however I wanted something a little more streamlined.
5
+
A command-line vanity (public) key generator for [WireGuard](https://www.wireguard.com/). By default, it only matches the prefix of generated public keys,
6
+
and not whether the search matches anywhere in the public key. The concept is based on
7
+
[wireguard-vanity-address](https://github.com/warner/wireguard-vanity-address), however I wanted something a little more streamlined.
6
8
7
9
8
10
## Features
@@ -51,10 +53,17 @@ private gJtn0woDChGvyN2eSdc7mTpAFA/nA6jykJeK5bYYfFA= public Pc7+UEJSHiWsQ9zkO2
51
53
private IMyPmYm/v0SPmB62hC8l6kfxT3/Lfp7dMioo+SM6T2c= public Pc7/uVfD/ZftxWBHwYbaudEywUS61biBcpj5Tw830Q4=
52
54
```
53
55
56
+
57
+
## Installing
58
+
59
+
Download the [latest binary release](https://github.com/axllent/wireguard-vanity-keygen/releases/latest) for your system,
60
+
or build from source `go install github.com/axllent/wireguard-vanity-keygen@latest`.
61
+
62
+
54
63
## Timings
55
64
56
65
To give you a rough idea of how long it will take to generate keys, the following table lists
57
-
estimated timings for each match on a system that reported "`Calculating speed: 230,000 calculations per second using 19 CPU cores`" when it started:
66
+
estimated timings to find a matching key on a system that reported "`Calculating speed: 230,000 calculations per second using 19 CPU cores`" when it started:
58
67
59
68
| Length | Case-insensitive | Case-sensitive |
60
69
| :------ | :--------------- | :------------- |
@@ -66,14 +75,16 @@ estimated timings for each match on a system that reported "`Calculating speed:
66
75
| 8 chars | 7 months | 38 years |
67
76
| 9 chars | 22 years | 175 years |
68
77
69
-
Note that the above timings are for finding a result for any search term.
70
-
Passing multiple search terms will not substantially increase the time,
71
-
but increasing the limit to two (`--limit 2`) will double the estimated time, three will triple the time, etc.
78
+
Note that the above timings are for finding a matching key for a single search term.
79
+
Passing multiple search terms will not substantially increase the time to find any single term, but the time to find
80
+
all search terms is the sum of all the estimated times.
81
+
Also, increasing the limit to two (`--limit 2`) will double the estimated time, three will triple the time, etc.
72
82
73
83
If any search term contains numbers, the timings would fall somewhere between the case-insensitive and case-sensitive columns.
74
84
75
85
Of course, your mileage will differ, depending on the number, and speed, of your CPU cores.
76
86
87
+
77
88
## Regular Expressions
78
89
79
90
Since each additional letter in a search term increases the search time exponentially, searching using a regular expression may
@@ -87,18 +98,14 @@ reduce the time considerably. Here are some examples:
87
98
88
99
A good guide on Go's regular expression syntax is at https://pkg.go.dev/regexp/syntax.
89
100
90
-
To include a `+` in your regular expression, preface it with a backslash, like `\+`.
101
+
To include a literal `+` in your regular expression, preface it with a backslash: `^ex\+`.
91
102
92
103
NOTE: If your search term contains shell metacharacters, such as `|`, or `^`, you will need to quote it.
93
104
On Windows, you must use double quotes. For example: `"^(a|b)"`.
94
105
95
106
NOTE: Complex regular expressions, such as those using escape sequences, flags, or character classes, may never match a key.
96
-
To avoid that, consider testing your regex using a tool such as [this one](https://go.dev/play/p/6LJy51Wd08O).
97
-
98
-
## Installing
99
-
100
-
Download the [latest binary release](https://github.com/axllent/wireguard-vanity-keygen/releases/latest) for your system,
101
-
or build from source `go install github.com/axllent/wireguard-vanity-keygen@latest`.
107
+
To avoid that, consider testing your regex using a tool such as [this one](https://go.dev/play/p/6LJy51Wd08O) on The Go Playground,
108
+
or the same tool on [goplay.tools](https://goplay.tools/snippet/6LJy51Wd08O).
102
109
103
110
104
111
## FAQ
@@ -109,16 +116,20 @@ Valid characters include `A-Z`, `a-z`, `0-9`, `/` and `+`. There are no other ch
109
116
110
117
You can also use regex expressions to search.
111
118
119
+
112
120
### Why does `test` & `tes1` show different probabilities despite having 4 characters each?
113
121
114
122
With case-insensitive searches (default), a-z have the chance of matching both uppercase and lowercase. A search for "cat" can match `Cat`, `cAT` etc.
115
123
116
124
117
125
### How accurate are the estimated times?
118
126
119
-
They are not (and cannot be) accurate. Keys are completely randomly generated, and the estimate is based on a law of averages. For instance, you could find a match for a one in a billion chance on the very first hit, or it could take you 5 billion attempts. It will however give you an indication based on your CPU speed, word count, case sensitivity, and use of numbers or characters.
127
+
They are not (and cannot be) accurate. Keys are completely randomly generated, and the estimate is based on a law of averages.
128
+
For instance, you could find a match for a one in a billion chance on the very first hit, or it could take you 5 billion attempts.
129
+
It will however give you an indication based on your CPU speed, word count, case sensitivity, and use of numbers or characters.
120
130
121
131
122
132
### Why do I need this?
123
133
124
-
You don't. I wrote it because I run a WireGuard server, which does not provide any reference as to who the key belongs to (`wg` on the server). Using vanity keys, I can at least identify connections. I also wanted to learn more about multi-core processing in Golang.
134
+
You don't. I wrote it because I run a WireGuard server, which does not provide any reference as to who the key belongs to (`wg` on the server).
135
+
Using vanity keys, I can at least identify connections. I also wanted to learn more about multi-core processing in Golang.
0 commit comments