The Rabin signature scheme is parametrized by a randomized
hash function H(m, u) of a message m and k-bit randomization string u. ; Public key : A public key is a pair of integers (n, b) with 0 \leq b and n odd. b is chosen arbitrarily and may be a fixed constant. ; Signature : A signature on a message m is a pair (u, x) of a k-bit string u and an integer x such that x (x + b) \equiv H(m, u) \pmod n. ; Private key : The private key for a public key (n, b) is the secret odd prime factorization p\cdot q of n, chosen uniformly at random from some large space of primes. ; Signing a message : To make a signature on a message m using the private key, the signer starts by picking a k-bit string u uniformly at random, and computes c := H(m, u). Let d = (b/2) \bmod n. If c + d^2 is a
quadratic nonresidue modulo n, the signer starts over with an independent random u. Otherwise, the signer computes \begin{align} x_p &:= \Bigl(-d \pm \sqrt{c + d^2}\Bigr) \bmod p, \\ x_q &:= \Bigl(-d \pm \sqrt{c + d^2}\Bigr) \bmod q, \end{align} using a
standard algorithm for computing square roots modulo a prime—picking p \equiv q \equiv 3 \pmod 4 makes it easiest. Square roots are not unique, and different variants of the signature scheme make different choices of square root; in any case, the signer must ensure not to reveal two different roots for the same hash c. x_p and x_q satisfy the equations \begin{align} x_p (x_p + b) &\equiv H(m,u) \pmod p, \\ x_q (x_q + b) &\equiv H(m,u) \pmod q. \end{align} The signer then uses the
Chinese remainder theorem to solve the system \begin{align} x &\equiv x_p \pmod p, \\ x &\equiv x_q \pmod q, \end{align} for x, so that x satisfies x (x + b) \equiv H(m,u) \pmod n as required. The signer reveals (u, x) as a signature on m. : The number of trials for u before x (x + b) \equiv H(m,u) \pmod n can be solved for x is geometrically distributed with an average around 4 trials, because about 1/4 of all integers are quadratic residues modulo n. == Security ==