• Adam Langley's avatar
    math/big: add 4-bit, fixed window exponentiation. · 73f11171
    Adam Langley authored
    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
    73f11171
nat.go 34.3 KB