Kunerth's algorithm is an algorithm for computing the modular square root of a given number.[1][2] The algorithm does not require the factorization of the modulus, and uses modular operations that are often easy when the given number is prime.
To find y {\displaystyle y} from a given value
it takes the following steps:
To obtain 41 mod 856 , {\displaystyle {\sqrt {41}}{\bmod {856}},} first obtain − 856 ≡ 13 ( mod 41 ) {\displaystyle {\sqrt {-856}}\equiv 13{\pmod {41}}} .
Then expand the polynomial:
into
Since, in this case the C term is a square, we take w = 5 {\displaystyle w=5} and compute v = 13 {\displaystyle v=13} (in general, v = 41 ⋅ z + 13 {\displaystyle v=41\cdot z+13} ).
In the case that − 856 mod 41 {\displaystyle {\sqrt {-856}}{\bmod {41}}} has no answer, then r ≡ − 856 ( mod b ⋅ 856 + 41 ) {\displaystyle r\equiv {\sqrt {-856}}{\pmod {b\cdot 856+41}}} can be used instead.