Which exponent(s) d will require this many?
Would greatly appreciate any advice as to how to go about solving this problem.
Which exponent(s) d will require this many?
Would greatly appreciate any advice as to how to go about solving this problem.
assuming unsigned integers and simple power by squaring algo like:
DWORD powuu(DWORD a,DWORD b)
{
int i,bits=32;
DWORD d=1;
for (i=0;i<bits;i++)
{
d*=d;
if (DWORD(b&0x80000000)) d*=a;
b<<=1;
}
return d;
}
You need just replace a*b
with modmul(a,b,n)
or (a*b)%n
so the answer is:
k
bits and l
from them are set you need k+l
multiplications2k
multiplications for exponent (2^k)-1
For more info see related QAs:
For a naive implementation, it's clearly the exponent with the largest Hamming weight (number of set bits). In this case (2^k - 1)
would require the most multiplication steps: (k)
.
For k-ary window methods, the number of multiplications can be made independent of the exponent. e.g., for a fixed window size: w = 3
we could compute {m^0, m^1, m^2, m^3, .., m^7}
group coefficients (all mod n
in this case, and probably in Montgomery representation for efficient reduction). The result is ceil(k/w)
multiplications. This is often preferred in cryptographic implementations, as the exponent is not revealed by simple timing attacks. Any k-bit exponent has the same timing. (The reality is a bit more complex if it is assumed the attacker has 'fine-grained' access to things like cache performance, etc.)
Sliding window techniques are typically more efficient, and only slightly more difficult to implement than fixed-window methods. however, they also leak side channel data, as timing will be dependent on the exponent. Furthermore, the 'best' sequence to use is known to be a hard problem.