bench isSquare
This commit is contained in:
parent
f35257d947
commit
74a23244d2
|
@ -128,6 +128,11 @@ proc invBench*(T: typedesc, iters: int) =
|
||||||
bench("Inversion (constant-time)", T, iters):
|
bench("Inversion (constant-time)", T, iters):
|
||||||
r.inv(x)
|
r.inv(x)
|
||||||
|
|
||||||
|
proc isSquareBench*(T: typedesc, iters: int) =
|
||||||
|
let x = rng.random_unsafe(T)
|
||||||
|
bench("isSquare (constant-time)", T, iters):
|
||||||
|
let qrt = x.isSquare()
|
||||||
|
|
||||||
proc sqrtBench*(T: typedesc, iters: int) =
|
proc sqrtBench*(T: typedesc, iters: int) =
|
||||||
let x = rng.random_unsafe(T)
|
let x = rng.random_unsafe(T)
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ proc main() =
|
||||||
toFieldBench(Fp[curve], Iters)
|
toFieldBench(Fp[curve], Iters)
|
||||||
smallSeparator()
|
smallSeparator()
|
||||||
invBench(Fp[curve], ExponentIters)
|
invBench(Fp[curve], ExponentIters)
|
||||||
|
isSquareBench(Fp[curve], ExponentIters)
|
||||||
sqrtBench(Fp[curve], ExponentIters)
|
sqrtBench(Fp[curve], ExponentIters)
|
||||||
sqrtRatioBench(Fp[curve], ExponentIters)
|
sqrtRatioBench(Fp[curve], ExponentIters)
|
||||||
# Exponentiation by a "secret" of size ~the curve order
|
# Exponentiation by a "secret" of size ~the curve order
|
||||||
|
|
|
@ -50,6 +50,7 @@ proc main() =
|
||||||
sqrUnrBench(Fp2[curve], Iters)
|
sqrUnrBench(Fp2[curve], Iters)
|
||||||
smallSeparator()
|
smallSeparator()
|
||||||
invBench(Fp2[curve], InvIters)
|
invBench(Fp2[curve], InvIters)
|
||||||
|
isSquareBench(Fp2[curve], InvIters)
|
||||||
sqrtBench(Fp2[curve], InvIters)
|
sqrtBench(Fp2[curve], InvIters)
|
||||||
separator()
|
separator()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue