Faster table compute in mpn_sec_powm

francisco delgado frdelgado at
Tue Mar 20 14:56:38 UTC 2018

For odd values of i

Instead of this
B^(2j+1) = (B^(j-1))*B 

Shouldn't be this?
B^(2j+1) = (B^j)^2*B


El mar, 20/3/18, Torbjörn Granlund <tg at> escribió:

 Asunto: Faster table compute in mpn_sec_powm
 Para: gmp-devel at
 Fecha: martes, 20 de marzo, 2018 13:53
 In the side-channel silent GMP mpn_sec_powm
 we compute a table of powers
 of the base B, from B^0 to B^k-1 for
 some table size k.
 We do this simple by using the
 recusrion B^k = B^k*B.
 I now realised this can be sped up very
  B^(2j)   = (B^j)^2   
   (i.e., even values of i)
  B^(2j+1) = (B^(j-1))*B  (i.e.,
 odd values of i)
 I.e., for even powers we do a squaring,
 while for odd numbers we do like
 Please encrypt, key id 0xC8601622
 gmp-devel mailing list
 gmp-devel at

More information about the gmp-devel mailing list