Input: P, k
Output: Q = [k]P
(1) Select a random r, ;
(2) Compute the NAF form of ;
(3) Add leading 0's in so that the number of bits in
is multiple of 2,
;
(4) ;
(5) While do
(5.1) set ;
(5.2) if then
(5.3) if then
(5.4)  set and
;
(5.5)  else
(5.6)  set and
;
(5.7) else
(5.8)  ;
(6) Pre-computation
;
(7) if then
    ;
else
;
(8) For from downto 0 do
(8.1) ;
(8.2) ;
(8.3) ;
(8.4) if then
(8.5)  ;
(8.6) else
(8.7)  ;
(9) Return .
Algorithm 7: DPA-resistant scalar multiplication algorithm.