dcrd/dcrec
Dave Collins b21feec2cd
secp256k1: Use field val for y coord decompression.
This modifies the core logic for decompressing a y coordinate from an x
coordinate, which is primarily used when parsing public keys, but can
also be used when recovering public keys from compact signatures in the
future, to make use of field vals and their recently-added optimized
modular square root calculation capability and also adds comprehensive
tests to ensure the decompression works properly independent of public
key parsing.

Since the public key type is still defined in terms of big ints, the
parsing function still relies on them and so the existing
decompressPoint function was updated to make use of the new function and
perform the necessary conversion to and from big ints.  Ultimately, the
goal is make that unnecessary.

This is work towards eventually using the new more efficient mod n
scalar throughout.

The following benchmark shows a before and after comparison of
decompressing a public key:

benchmark                   old ns/op    new ns/op   delta
-------------------------------------------------------------
BenchmarkPubKeyDecompress   43574        10961       -74.85%

benchmark                   old allocs   new allocs  delta
-------------------------------------------------------------
BenchmarkPubKeyDecompress   28           0           -100.00%

benchmark                   old bytes    new bytes   delta
-------------------------------------------------------------
BenchmarkPubKeyDecompress   2586         0           -100.00%
2020-02-20 12:08:29 -06:00
..
edwards edwards: Remove unused code. 2019-10-30 20:40:07 -05:00
secp256k1 secp256k1: Use field val for y coord decompression. 2020-02-20 12:08:29 -06:00
common.go multi: Address some golint complaints. 2018-10-10 19:50:06 -05:00
go.mod build: Tidy module sums (go mod tidy). 2019-03-25 11:37:00 -05:00