Algorithm 5.1 The NAF computation of a positive integer

```
 

Input: A positive integer v in [1, n-1].
Output: The expansion NAF (v).
1. i 0.
2. While v ≥ 1 do
  2.1 If v is odd then ei 2 � (v mod 4),
       v v � ei ;
  2.2 Else: ei 0.
  2.3 End if
3. v v /2, i i +1.
4. End while
```

```
5. Return ðei�1; …;e1;e0Þ:
```
The computation of a scalar multiplication vP by employing the NAF algorithm can be done using the following algorithm:
