27 lines
1.4 KiB
Go
27 lines
1.4 KiB
Go
package main_test
|
|
|
|
import (
|
|
"fmt"
|
|
"math/big"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestPow(t *testing.T) {
|
|
|
|
n, _ := big.NewInt(1).SetString("151787717184422252307365020658866150659139813606887864663574443176328014948429913407344055128026662986925949147541666619511526142491196760869802510776788353419093645990851372578901256051814507665042918937343846064086867942964225457691185973174205523727877484153730596121423900155549117133518141928295347285789", 10)
|
|
m, _ := big.NewInt(1).SetString("15178771718442225230736502065886615065913981360688786466357444317632801494842991340734405512802666298692594914754166661951152614249119676086980251077678835341909364599085137257890125605181450766504291893734384606408686794296422545769118597317420552372787748415373059612142390015554911713351814192829534728578", 10)
|
|
d, _ := big.NewInt(1).SetString("141787717184422252307365020658866150659139813606887864663574443176328014948429913407344055128026662986925949147541666619511526142491196760869802510776788353419093645990851372578901256051814507665042918937343846064086867942964225457691185973174205523727877484153730596121423900155549117133518141928295347285789", 10)
|
|
c := big.NewInt(1)
|
|
|
|
cnt := 10000
|
|
start := time.Now()
|
|
for i := 0; i < cnt; i++ {
|
|
c.Exp(m, d, n)
|
|
}
|
|
elapsed := time.Since(start)
|
|
fmt.Printf("Sign %d times\n", cnt)
|
|
fmt.Printf("Used time: %d ms, %d pcs/s\n", elapsed.Milliseconds(), int(float64(cnt)/float64(elapsed.Seconds())))
|
|
|
|
}
|