secp256k1: Add benchmark for pubkey decompression.
This commit is contained in:
parent
cd441ba534
commit
4c1fe027bb
@ -185,3 +185,20 @@ func BenchmarkNonceRFC6979(b *testing.B) {
|
||||
}
|
||||
_ = noElideNonce
|
||||
}
|
||||
|
||||
// BenchmarkPubKeyDecompress benchmarks how long it takes to decompress the y
|
||||
// coordinate from a given public key x coordinate.
|
||||
func BenchmarkPubKeyDecompress(b *testing.B) {
|
||||
// Randomly generated keypair.
|
||||
// Private key: 9e0699c91ca1e3b7e3c9ba71eb71c89890872be97576010fe593fbf3fd57e66d
|
||||
pubKeyX := fromHex("d2e670a19c6d753d1a6d8b20bd045df8a08fb162cf508956c31268c6d81ffdab")
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := decompressPoint(pubKeyX, false)
|
||||
if err != nil {
|
||||
b.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user