Research Article

A Hardware-Efficient Elliptic Curve Cryptographic Architecture over GF (p)

Algorithm 3

Binary modular inversion (IBMI) algorithm.
Input:
Output: , satisfying
Step 1: ;
Step 2: if ( is even) {
;
 if (r is odd) ;
 else if (r is negative) ;
 else ;
 }
Step 3: if ( is even) {
;
 if (s is odd) ;
 else if (s is negative) ;
 else;
 }
Step 4: if (u and are odd) {
 if() ;
 else ;
 }
Step 5: if () {
  if () {return ; }
  else { return .}
 }
 else if () {
  if () {return ; }
  else {return .}
 }
 else {go to step2.}