@@ -26,6 +26,7 @@ import (
2626type keySet struct {
2727 priv ed25519.PrivateKey
2828 pub ed25519.PublicKey
29+ count uint64
2930}
3031
3132func main () {
@@ -36,6 +37,8 @@ func main() {
3637 threads := runtime .GOMAXPROCS (0 )
3738 fmt .Println ("Threads:" , threads )
3839 start := time .Now ()
40+ var totalKeys uint64
41+ totalKeys = 0
3942 var currentBest ed25519.PublicKey
4043 newKeys := make (chan keySet , threads )
4144 for i := 0 ; i < threads ; i ++ {
@@ -44,8 +47,9 @@ func main() {
4447 for {
4548 newKey := <- newKeys
4649 if isBetter (currentBest , newKey .pub ) || len (currentBest ) == 0 {
50+ totalKeys += newKey .count
4751 currentBest = newKey .pub
48- fmt .Println ("-----" , time .Since (start ))
52+ fmt .Println ("-----" , time .Since (start ), "---" , totalKeys , "keys tried" )
4953 fmt .Println ("Priv:" , hex .EncodeToString (newKey .priv ))
5054 fmt .Println ("Pub:" , hex .EncodeToString (newKey .pub ))
5155 addr := address .AddrForKey (newKey .pub )
@@ -68,18 +72,22 @@ func isBetter(oldPub, newPub ed25519.PublicKey) bool {
6872
6973func doKeys (out chan <- keySet ) {
7074 bestKey := make (ed25519.PublicKey , ed25519 .PublicKeySize )
75+ var count uint64
76+ count = 0
7177 for idx := range bestKey {
7278 bestKey [idx ] = 0xff
7379 }
7480 for {
7581 pub , priv , err := ed25519 .GenerateKey (nil )
82+ count ++
7683 if err != nil {
7784 panic (err )
7885 }
7986 if ! isBetter (bestKey , pub ) {
8087 continue
8188 }
8289 bestKey = pub
83- out <- keySet {priv , pub }
90+ out <- keySet {priv , pub , count }
91+ count = 0
8492 }
8593}
0 commit comments