Created
January 29, 2018 02:20
-
-
Save bradylove/0ada9730dbdb48c8661854bd921c06f5 to your computer and use it in GitHub Desktop.
Stellar Key Pair Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"runtime" | |
"strings" | |
"sync" | |
"time" | |
"github.com/stellar/go/keypair" | |
) | |
var ( | |
suffix = flag.String("suffix", "", "suffix that the public key should end with.") | |
) | |
func main() { | |
flag.Parse() | |
procs := runtime.NumCPU() | |
var wg sync.WaitGroup | |
wg.Add(procs) | |
startTime := time.Now() | |
for i := 0; i < procs; i++ { | |
go func(startTime time.Time) { | |
for { | |
kp, err := keypair.Random() | |
if err != nil { | |
panic(err) | |
} | |
if strings.HasSuffix(kp.Address(), *suffix) { | |
fmt.Println("Public Key: ", kp.Address()) | |
fmt.Println("Private Key:", kp.Seed()) | |
fmt.Println("Time Taken: ", time.Since(startTime)) | |
os.Exit(0) | |
} | |
} | |
}(startTime) | |
} | |
wg.Wait() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment