The least significant bit of RSA #
The RSA least-significant-bit experiment, together with the exact inversion of RSA from a perfect least-significant-bit predictor.
For odd N and k ≥ 1, the parity of 2 ^ k * x % N is the parity of ⌊2 ^ k * x / N⌋
(two_pow_mul_mod_mod_two), and 2 ^ k * x % N is the RSA preimage of 2 ^ (k * e) * y % N
when y = x ^ e % N. So the parities answered on the m public queries 2 ^ (k * e) * y % N,
k = 1, …, m, are the most-significant-first binary digits (BitString.binaryValue) of
⌊2 ^ m * x / N⌋ (binaryValue_testBit_two_pow_mul_mod), which determines x once
N ≤ 2 ^ m (lsbRecover). The inverter lsbInverter runs a predictor on these queries and
recovers x exactly whenever the predictor is always correct on the modulus (eval_lsbInverter).
Main definitions #
Cslib.Crypto.RSAPredictor,Cslib.Crypto.RSAPredictor.IsPPT,Cslib.Crypto.rsaLSBGame: one-bit predictors and the least-significant-bit prediction experiment.Cslib.Crypto.lsbQueries,Cslib.Crypto.lsbRecover: the doubling queries, and the final rounding of the most-significant-first value of the answered parities.Cslib.Crypto.lsbInverter: the inverter that queries a predictor on theN.sizedoubling queries.
Main results #
Cslib.Crypto.two_pow_mul_mod_mod_two: parity of a doubled residue modulo an odd modulus.Cslib.Crypto.lsbRecover_lsbQueries: a correct parity oracle determines the RSA preimage.Cslib.Crypto.eval_lsbInverter,Cslib.Crypto.succProbability_rsaInversionGame_lsbInverter: a perfect predictor inverts RSA with certainty.Cslib.Crypto.computableInPolyTime_lsbQueries,Cslib.Crypto.computableInPolyTime_lsbRecover,Cslib.Crypto.isPPT_lsbInverter: uniform polynomial-time and strict-PPT efficiency certificates for the query generator, recovery arithmetic, and doubling inverter.Cslib.Crypto.RSAOneWay.not_frequently_alwaysCorrect_lsbPredictor: underRSAOneWayon eventually odd moduli, no strict-PPT predictor is always correct on infinitely many parameters.
Implementation notes #
rsaLSBGame runs Cslib.Crypto.predictionExperiment on x drawn uniformly from Fin N, as
rsaInversionGame does, rather than from (ZMod N)ˣ. An RSAPredictor receives the public key
and a challenge residue; RSAPredictor.IsPPT reads encRSAInput, like RSAInverter.IsPPT, and
writes a bit.
[KL20], Theorem 12.31, states that the least significant bit is hard-core
for RSA whenever RSA is hard: under RSAOneWay gen, every PPT predictor has negligible
Game.guessingAdvantage in rsaLSBGame gen. Its proof must handle predictors that are only
noticeably better than a fair guess; that reconstruction is not formalized here, and the theorem is
not stated as an assumption either, since a premise would stand in for its proof (#5578).
RSAOneWay.not_frequently_alwaysCorrect_lsbPredictor establishes only the noiseless consequence
(isPPT_lsbInverter plus succProbability_rsaInversionGame_lsbInverter) for predictors that are
always correct on every residue modulo N.
HardCore in CslibFrontier.Crypto.Computational.HardCore covers unkeyed functions on uniform bit
strings, so it cannot express a predicate of a uniform residue under generated RSA keys;
rsaLSBGame is a separate keyed game that reuses Game.guessingAdvantage.
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, Section 12.5.3, pp. 443–445 (Theorem 12.31 and the noiseless doubling inversion).
The prediction experiment #
A one-bit predictor for RSA: given the security parameter, a public key (N, e) and a residue
modulo N, it outputs a bit, whose meaning is fixed by the experiment (the least significant bit
of the preimage in rsaLSBGame) or by a correctness hypothesis. RSAPredictor.IsPPT states its
efficiency on encodings.
An RSA predictor is PPT when one uniform strict PPT machine reads encRSAInput and writes the
predicted bit.
The RSA least-significant-bit experiment: sample desc ← gen n and run
Cslib.Crypto.predictionExperiment on a uniform residue x modulo N. The predictor receives
(pk, x ^ e % N) and wins when it returns the least significant bit x.testBit 0 of x. That
every PPT predictor has negligible Game.guessingAdvantage here under RSAOneWay gen is the
hard-core theorem described in the module documentation, which is not formalized.
rsaLSBGame written out: the predictor sees the RSA image of a uniform residue x.
Doubling and parity #
The public doubling queries 2 ^ (k * e) * y % N for k = 1, …, m.
Rounding ⌊2 ^ m * x / N⌋ * N / 2 ^ m up recovers x once N ≤ 2 ^ m.
A parity oracle that is correct on all RSA images modulo an odd N determines the preimage
from the m doubling queries, once N ≤ 2 ^ m.
The inverter #
The inverter built from a least-significant-bit predictor P: on (pk, y) with
pk = (N, e), run P on the N.size doubling queries and round the value of the answers.
If P predicts the least significant bit correctly with certainty on every RSA image modulo
an odd N, then lsbInverter P returns the preimage of every y = x ^ e % N with certainty.
A predictor that is always correct on the odd moduli produced by gen n yields an inverter
that wins the RSA inversion experiment with probability one.
Efficiency certificates and noiseless impossibility #
Generating the m doubling queries 2 ^ ((k + 1) * e) * y % N is computable in polynomial
time when N, e, and y are binary, m is unary, and 0 < N.
Computing lsbRecover N m bits = (BitString.binaryValue bits * N + 2 ^ m - 1) / 2 ^ m is
computable in polynomial time when N is binary and m is unary.
lsbInverter P runs in uniform strict polynomial time whenever the predictor P is PPT.
Under RSAOneWay gen and eventually odd moduli, no uniform strict-PPT predictor can predict
x.testBit 0 with certainty on every residue modulo N for infinitely many security parameters
(the noiseless corollary of isPPT_lsbInverter and
succProbability_rsaInversionGame_lsbInverter).