Skip to content

Commit

Permalink
show speed
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarrier committed Jul 3, 2022
1 parent 6a63ffd commit 6637e9b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func main() {
researched := regexp.MustCompile(flag.Arg(0))

log.Printf("Looking for a public key matching %v", researched)
start := time.Now()
attempts := int64(0)
resultCh := make(chan result, 1)

Expand Down Expand Up @@ -106,7 +107,8 @@ func main() {
log.Printf("Private key:\n%s", found.privRepr)
os.Exit(0)
case <-ticker.C:
log.Printf("Generated %s keypairs", printer.Sprint(atomic.LoadInt64(&attempts)))
rate := int(float64(attempts) / time.Since(start).Seconds())
log.Printf("Generated %s keypairs (%s Hz)", printer.Sprint(atomic.LoadInt64(&attempts)), printer.Sprint(rate))
}
}
}

0 comments on commit 6637e9b

Please sign in to comment.