diff options
author | lloyd <[email protected]> | 2011-05-17 19:57:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-05-17 19:57:34 +0000 |
commit | b0560e9a8fee0391146e3b4ad25434950aba80e2 (patch) | |
tree | c3d39cdae524a2414138764db274829b9c8607c7 /src/math/numbertheory/pow_mod.cpp | |
parent | e6d4bee20f480b6bd0dd1c01fde491529dac10cc (diff) |
Modify ECC points to do all math in Montgomery form, rather than
converting back and forth. This gives a 10 to 20% speedup on a Core
i7. In addition, the CurveGFp no longer contains a Barrett reducer,
saving 3 BigInts worth of memory.
Add a #if'ed out alternative to point multiplication using the
Montgomery ladder technique. It runs in (more or less) constant time,
but rather significantly slower than the 4 bit window technique
currently used.
Tweak the window sizes to match the theoretical optimums.
Diffstat (limited to 'src/math/numbertheory/pow_mod.cpp')
-rw-r--r-- | src/math/numbertheory/pow_mod.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/math/numbertheory/pow_mod.cpp b/src/math/numbertheory/pow_mod.cpp index a66a1f7df..bf6b29275 100644 --- a/src/math/numbertheory/pow_mod.cpp +++ b/src/math/numbertheory/pow_mod.cpp @@ -118,7 +118,12 @@ size_t Power_Mod::window_bits(size_t exp_bits, size_t, Power_Mod::Usage_Hints hints) { static const size_t wsize[][2] = { - { 2048, 7 }, { 1024, 6 }, { 256, 5 }, { 128, 4 }, { 64, 3 }, { 0, 0 } + { 1434, 7 }, + { 539, 6 }, + { 197, 4 }, + { 70, 3 }, + { 25, 2 }, + { 0, 0 } }; size_t window_bits = 1; |