Number theory is full of gems that turn into effective algorithms demanded in cryptography. Consider the congruence
where N is odd, and R > N is a power of 2.
Probably the most effective algorithm to solve it is based on the Hensel’s lemma; the corollary that applies for our congruence is: suppose we know the solution for :
then the solution for
is either or
We start with the trivial
which can be nothing else but ; next,
which can be either or ; checking the first alternative gives , so ; next,
; checking gives , so ; next,
; checking gives , so ; finally,
; checking gives , so .
The solution of the congruence is .