Timing Attack on RSA

We create a random string of bits, don’t display it yet. Starts with 1.

 
Setup a modulus and base.

 
Time the full computation.

 
Now time just the second multiplication.

 
Now check variances.

 
Now check what the beginning of b was: