Solving two-variable linear Diophantine equations has applications in many cryptographic protocols such as RSA and Elliptic curve cryptography. The Extended Euclid's algorithm is a well known algorithm to solve these equations. We revisit two algorithms to solve two-variable linear Diophantine equations. We write the iterative version of one of the revisited algorithms. For another, we do a fine-grained analysis of the number of recursive calls and arrive at a periodic function that represents the number of recursive calls. We find the period and use it to derive multiple upper bounds on the average number of recursive calls. The upper bounds conclude that the average number of recursive calls in the analyzed algorithm is a constant term improvement over the Extended Euclid's algorithm. We propose an iterative variant of the algorithm. We implement this algorithm and find that the average number of iterations by our algorithm is less than that of two existing algorithms. We compare the number of iterations in this algorithm and in Extended Euclid's algorithm. In the comparison, we find that for 100\% of the solvable instances of inputs, the iterations are less than that in Extended Euclid's algorithm.
翻译:暂无翻译