ElGamal signature scheme 2026-10-05
For a prime number , primitive root and public key , choose a fresh secret coprime to , set and , and verify . Reusing the cryptographic nonce can reveal secret information. The unhashed historical construction allows existential forgery of specially chosen message exponents, so authentication claims require suitable hashing and protocol assumptions.
Euler criterion Created 2026-09-24 Updated 2026-09-24
For an odd prime ,
For , write using a primitive root ; then the left side is , which is one exactly when is even and is a square.
For an odd prime , the Legendre symbol is if , if is a nonzero square modulo , and otherwise. Euler's criterion states
If both sides vanish. Otherwise write for a primitive root . The squares are precisely the even powers of , while has order two and therefore equals . Hence , proving the criterion and the useful special case .
For odd , . Every prime divisor of this number is odd, and , so . Euler's criterion forces , hence or . A product of such primes can be only if a prime occurs to an odd power.
Suppose the primes were . Choose the odd integer (or for an empty list). None of these primes divides , since the latter is modulo each . Yet the preceding argument gives a prime divisor , outside the list. This contradiction proves infinitely many primes congruent to modulo .
An Euler pseudoprime is an odd composite number with satisfying , where the right side is the Jacobi symbol. A weaker convention requires only ; it is distinguished below. A strong pseudoprime, with and odd, satisfies or for some .
By the Chinese remainder theorem for unit groups, the unit group modulo is . Modulo , . Thus the only possible sign in is positive. Modulo , writing for a primitive root, the condition is , equivalently . Consequently has multiplicative order dividing in each factor. Its square is either or in each factor, but these signs must agree: modulo , the Legendre symbol is for square and for square , and the same is true modulo . The Euler pseudoprime condition additionally requires the product of those Legendre symbols to be . Hence
Each sign has two roots modulo each prime, hence four roots modulo . There are eight pseudoprime bases modulo under the Jacobi symbol convention. Under the weaker sign-only convention there are instead sixteen pseudoprime bases, since the two signs of the squares need not agree; the stated equivalence therefore specifically uses the Jacobi symbol convention.
For the strong pseudoprime condition, . Since the unit group has exponent of a finite group , the only possibilities are or . The six pseudoprime bases are . For example , while has but . Thus the strong-pseudoprime pseudoprime bases are not a subgroup.
In the RSA cryptosystem, choose distinct large prime numbers , set , and choose coprime to . Choose with . A plaintext residue class is encrypted as and decrypted as . Fermat's little theorem modulo and , followed by the Chinese remainder theorem, proves correctness even when is not coprime to .
Textbook RSA cryptosystem is multiplicative: . For a chosen-ciphertext attack, multiply an intercepted by for a known invertible . A decryption oracle returns , from which multiplication by recovers . Likewise, multiplying two textbook RSA signatures produces a signature of their product. These are homomorphism attacks, exploiting algebra rather than factoring .
For an ElGamal signature, choose a prime , a primitive root modulo , a private exponent , and public . To sign a message digest , choose a fresh secret coprime to and set
Verification checks and , which follows because . Authenticating the ciphertext and its context with such a digital signature, before decryption, prevents the simple multiplicative modification from being accepted without a fresh valid signature. One needs an appropriate cryptographic hash function and fresh secret cryptographic nonces: this is not a claim that every algebraic attack is impossible. In particular, the unhashed historical ElGamal signature scheme admits existential forgeries of specially chosen message exponents; mere multiplication of encrypted messages is not an authentication mechanism.
The Fermat-Euler theorem states that
Indeed, if are the reduced residue classes modulo , multiplication by permutes them. Therefore
The product is invertible modulo , so cancellation gives the theorem.
Now let be prime. If , then for , Fermat little theorem gives , while makes . Thus for every integer .
Conversely, assume this congruence holds for every . Choose a primitive root modulo . Then . Since has order , one has . Hence
An odd composite coprime to is a Fermat pseudoprime to base when . It is a Carmichael number when this congruence holds for every coprime to .
Suppose a Carmichael number has with . The group is cyclic, so choose a residue of order
By the Chinese remainder theorem, extend it to an integer that is congruent to modulo every other prime-power factor of . Then , and the Carmichael congruence forces the order of modulo to divide . In particular , contradicting . Therefore every Carmichael number is square-free.
Now assume is square-free. If for every , then for every coprime to , Fermat little theorem gives
for each . The Chinese remainder theorem then gives the congruence modulo , so is Carmichael.
Conversely, if is Carmichael, fix . Choose a primitive root modulo and use the Chinese remainder theorem to choose and . Then , so the order of divides . This proves the Korselt criterion in the required form:
A Carmichael number cannot have one prime factor because it is composite. If with distinct primes , the condition implies , which is impossible. Hence every Carmichael number has at least three prime factors.
For , the convention gives . Now suppose and choose a primitive root modulo . The nonzero residues are for , while the term vanishes. Hence
This is a finite geometric series. Since but by Fermat's little theorem, multiplication by the nonzero residue gives
The factor is invertible modulo the prime number , so
Euler's criterion states that for an odd prime number and ,
where the right-hand side is the Legendre symbol.
Let be a primitive root modulo . Its multiplicative order is , so . This power has square , and the only roots of modulo the odd prime are . Therefore
Euler's criterion now gives , so every primitive root is a quadratic nonresidue.
Now let be a Fermat prime, with . The number of primitive roots modulo is
There are also exactly quadratic nonresidues. Since every primitive root is a nonresidue, these equally large sets coincide. Thus every quadratic nonresidue modulo is a primitive root, as summarized by Quadratic nonresidues modulo a Fermat prime.
Finally, and . Quadratic reciprocity therefore gives
Hence is a quadratic nonresidue modulo , and consequently
For an odd prime , the Legendre symbol is
Euler criterion states that
If , both sides vanish. Otherwise choose a primitive root and write . Since ,
The power is a square exactly when is even, proving the criterion. Taking gives the first supplementary law for quadratic reciprocity