]> Cypherpunks repositories - gostls13.git/commit
math/big: add 4-bit, fixed window exponentiation.
authorAdam Langley <agl@golang.org>
Wed, 17 Oct 2012 15:19:26 +0000 (11:19 -0400)
committerAdam Langley <agl@golang.org>
Wed, 17 Oct 2012 15:19:26 +0000 (11:19 -0400)
commit73f11171b4965af85d9c410bb34a2940f798a7ed
treeba201ebaa687f49bff399d3f19f3148dff500e95
parentace9ff4578cb6d3077fbd2c7934b4ac063047145
math/big: add 4-bit, fixed window exponentiation.

A 4-bit window is convenient because 4 divides both 32 and 64,
therefore we never have a window spanning words of the exponent.
Additionaly, the benefit of a 5-bit window is only 2.6% at 1024-bits
and 3.3% at 2048-bits.

This code is still not constant time, however.

benchmark                        old ns/op    new ns/op    delta
BenchmarkRSA2048Decrypt           17108590     11180370  -34.65%
Benchmark3PrimeRSA2048Decrypt     13003720      7680390  -40.94%

R=gri
CC=golang-dev
https://golang.org/cl/6716048
src/pkg/math/big/nat.go