]> Cypherpunks repositories - gostls13.git/commit
math/big: speed up GCD x, y calculation
authorBrian Kessler <brian.m.kessler@gmail.com>
Fri, 21 Jul 2017 06:31:51 +0000 (23:31 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 16 Aug 2017 09:13:12 +0000 (09:13 +0000)
commit53836a74f8b0137ebd52f0279edc16fc7d5cf2ca
tree23ec80e6052e054bf247cdc4d5724de8f5cd2c7c
parent12465661421f3598cb76a787fba75da8cabc220d
math/big: speed up GCD x, y calculation

The current implementation of the extended Euclidean GCD algorithm
calculates both cosequences x and y inside the division loop. This
is unneccessary since the second Bezout coefficient can be obtained
at the end of calculation via a multiplication, subtraction and a
division.  In case only one coefficient is needed, e.g. ModInverse
this calculation can be skipped entirely.  This is a standard
optimization, see e.g.

"Handbook of Elliptic and Hyperelliptic Curve Cryptography"
Cohen et al pp 191
Available at:
http://cs.ucsb.edu/~koc/ccs130h/2013/EllipticHyperelliptic-CohenFrey.pdf

Updates #15833

Change-Id: I1e0d2e63567cfed97fd955048fe6373d36f22757
Reviewed-on: https://go-review.googlesource.com/50530
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/big/int.go