github.com/piotrnar/gocoin@v0.0.0-20240512203912-faa0448c5e96/lib/others/cgo/ec_bench/openssl.go (about) 1 package main 2 3 import ( 4 "sync" 5 "time" 6 "encoding/hex" 7 "github.com/piotrnar/gocoin/lib/others/cgo/openssl" 8 ) 9 10 var CNT int = 15*250 11 12 func main() { 13 key, _ := hex.DecodeString("040eaebcd1df2df853d66ce0e1b0fda07f67d1cabefde98514aad795b86a6ea66dbeb26b67d7a00e2447baeccc8a4cef7cd3cad67376ac1c5785aeebb4f6441c16") 14 sig, _ := hex.DecodeString("3045022100fe00e013c244062847045ae7eb73b03fca583e9aa5dbd030a8fd1c6dfcf11b1002207d0d04fed8fa1e93007468d5a9e134b0a7023b6d31db4e50942d43a250f4d07c") 15 msg, _ := hex.DecodeString("3382219555ddbb5b00e0090f469e590ba1eae03c7f28ab937de330aa60294ed6") 16 var wg sync.WaitGroup 17 sta := time.Now() 18 for i:=0; i<CNT; i++ { 19 wg.Add(1) 20 go func() { 21 if openssl.EC_Verify(key, sig, msg)!=1 { 22 println("Verify error") 23 } 24 wg.Done() 25 }() 26 } 27 wg.Wait() 28 sto := time.Now() 29 println((sto.UnixNano()-sta.UnixNano())/int64(CNT), "ns per ECDSA_Verify") 30 }