How can you compute modular exponentiation in a Time Safe way, regarding some pseudocode or a link?
Make sure you do fixed computation regardless of data involved. This involves slowing things down and making sure the CPU/compiler does not optimize anything so things become unbalanced.
Straightforward way to make this constant time is to do the multiplication always and discard the result for 0 bits.
Motivation of the sliding window algoritms is that they are faster and also believed to be "more constant time" than the straightforward square and multiply.