in which the variable i is decremented the step e 216 then tests if the variable i has reached 0 if not not all the bits of the secret key d have been processed and the next iteration of the loop follows by going to the step e 204 described above if so all the bits of the secret key have been processed and the modular exponentiation is therefore finished the variable a 1 corresponds to the required result that is to say m d mod n the value a 1 is therefore returned at the output of the subroutine described here in the step e 218 alternatively the step e 210 can be executed between the steps e 216 and e 218 instead of or in addition to the step e 210 described above if the step e 210 is no longer performed in the loop but only after the loop for example between the steps e 216 and e 218 the test phases of the algorithm are simplified a third embodiment of the invention is described next with reference to fig3 and is used in the context of modular exponentiation using the chinese remainders theorem crt the algorithm shown in fig3 receives as input the number or message m to which the modular exponentiation is to be applied the two prime numbers p q constituting the public modulus n p u00b7 q the components d p d q of the secret key d relating to p and q where d p d mod.