Skip to content

Commit e2a8e92

Browse files
committed
Merge bitcoin-core#404: Replace 3M + 4S doubling formula with 2M + 5S one
8ec49d8 Add note about 2M + 5S doubling formula (Andrew Poelstra)
2 parents 5a91bd7 + 8ec49d8 commit e2a8e92

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/group_impl.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,13 @@ static int secp256k1_ge_is_valid_var(const secp256k1_ge *a) {
249249
}
250250

251251
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) {
252-
/* Operations: 3 mul, 4 sqr, 0 normalize, 12 mul_int/add/negate */
252+
/* Operations: 3 mul, 4 sqr, 0 normalize, 12 mul_int/add/negate.
253+
*
254+
* Note that there is an implementation described at
255+
* https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
256+
* which trades a multiply for a square, but in practice this is actually slower,
257+
* mainly because it requires more normalizations.
258+
*/
253259
secp256k1_fe t1,t2,t3,t4;
254260
/** For secp256k1, 2Q is infinity if and only if Q is infinity. This is because if 2Q = infinity,
255261
* Q must equal -Q, or that Q.y == -(Q.y), or Q.y is 0. For a point on y^2 = x^3 + 7 to have

0 commit comments

Comments
 (0)