aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet/cmd/vanityid/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet/cmd/vanityid/main.go')
-rw-r--r--src/gnunet/cmd/vanityid/main.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gnunet/cmd/vanityid/main.go b/src/gnunet/cmd/vanityid/main.go
index 938df61..1c0bf24 100644
--- a/src/gnunet/cmd/vanityid/main.go
+++ b/src/gnunet/cmd/vanityid/main.go
@@ -8,8 +8,9 @@ import (
8 "regexp" 8 "regexp"
9 "time" 9 "time"
10 10
11 "github.com/bfix/gospel/crypto/ed25519"
12 "gnunet/util" 11 "gnunet/util"
12
13 "github.com/bfix/gospel/crypto/ed25519"
13) 14)
14 15
15func main() { 16func main() {
@@ -32,16 +33,13 @@ func main() {
32 seed := make([]byte, 32) 33 seed := make([]byte, 32)
33 start := time.Now() 34 start := time.Now()
34 for i := 0; ; i++ { 35 for i := 0; ; i++ {
35 n, err := rand.Read(seed) 36 _, _ = rand.Read(seed)
36 if err != nil || n != 32 {
37 panic(err)
38 }
39 prv := ed25519.NewPrivateKeyFromSeed(seed) 37 prv := ed25519.NewPrivateKeyFromSeed(seed)
40 pub := prv.Public().Bytes() 38 pub := prv.Public().Bytes()
41 id := util.EncodeBinaryToString(pub) 39 id := util.EncodeBinaryToString(pub)
42 for _, r := range reg { 40 for _, r := range reg {
43 if r.MatchString(id) { 41 if r.MatchString(id) {
44 elapsed := time.Now().Sub(start) 42 elapsed := time.Since(start)
45 s1 := hex.EncodeToString(seed) 43 s1 := hex.EncodeToString(seed)
46 s2 := hex.EncodeToString(prv.D.Bytes()) 44 s2 := hex.EncodeToString(prv.D.Bytes())
47 fmt.Printf("%s [%s][%s] (%d tries, %s elapsed)\n", id, s1, s2, i, elapsed) 45 fmt.Printf("%s [%s][%s] (%d tries, %s elapsed)\n", id, s1, s2, i, elapsed)