Suppose Alice and Bob wish to perform a Diffie-Hellman key exchange. Then for some they pick an -bit prime , and an element that is a generator of a cyclic group of prime order .
Then Alice picks a random and sends to Bob, and Bob picks a random and sends to Alice. They both compute their shared secret . But this is not the whole story: now they must somehow derive a session key from this quantity. To an adversary, the session key should be indistinguishable from a random string.
In practice, an off-the-shelf hash function such as SHA1 is applied to some representation of , and then the 128 LSBs are used as the key. Unfortunately the only known way to prove that this is secure is to "prove by assumption": i.e. concoct the Hash Diffie-Hellman assumption.
Security from the CDH assumption
One obvious way to proceed is to extract a hardcore bit of . For example, using the Goldreich-Levin method, they can find a hardcore bit , and to derive a 128-bit key, they simply perform 128 Diffie-Hellman exchanges and extract each time. This is secure provided we assume no efficient Computational Diffie-Hellman algorithm exists, for then the adversary should not be able to distinguish between the distributions and . More formally:
Theorem: If the CDH problem is -hard then there is no -distinguisher between
and
Sketch of proof: distinguisher predictor for th bit predictor for given CDH algorithm.
However, this method is impractical as it requires one Diffie-Hellman exchange for each bit of the session key. Unfortunately, it is not known how to improve this method much without using a stronger assumption:
Security from the DDH assumption
The -Decisional Diffie-Hellman (DDH) assumption says that the distribution
is -indistinguishable from the distribution
(In other words, given and , is indistinguishable from a random element, which implies that bits of are simultanesouly secure given .
Using this assumption allows a provably secure scheme for extracting a session key, via the left-over lemma.
Let be a 1024-bit prime, and let be a 255-bit prime such that is a subgroup of of order , and let be a generator of . Let , and suppose . Set , and let . be almost universal. Then consider the following key exchange protocol:
Alice picks and sends to Bob. Similarly, Bob picks and sends to Alice. They both compute the secret key .
Theorem: Assuming -DDH on , the distributions
and
are -indistinguishable.
Proof: Suppose is a -distiguisher. Then we can construct a DDH-distiguisher as follows.
-
is given a tuple .
-
picks random , and computes .
-
gives the tuple to , and outputs the output of .
We show that is a -DDH algorithm. Note
where we have used the inequality . Now the first term is at least , while the second term is at most by the leftover lemma.
Leftover Lemma
The leftover lemma shows how to extracts randomness from a "defective" random source.
Definition: Let
is called a universal family of hash functions if for all we have
is almost universal if for all we have
A set of all linear congruential generators (modulo some prime ) is an example of an almost universal family of hash functions.
Definition: Let be a finite set and be distributions on . For all , denote the probability of picking according to by , and for all , define . Define the following:
-
The collision probability of is .
-
are -statistically indistinguishable if for all , we have .
-
is -quasirandom if is -statistically indistinguishable from the uniform distribution on (which we denote by . Hence for any subset we have
Quasirandomness is useful. For suppose is -quasirandom on . Then for any algorithm , we have
Proof: Let be . Then
Leftover Lemma: Let , . Let and let be an almost universal hash family from to . Then the distribution is -quasirandom on .
Proof: there are two steps to the proof.
Claim: (proof omitted) because is almost universal, the collision probability
Claim: Let be a distribution on a finite set . If then is -quasirandom.
Proof of claim: Suppose there exists some subset such that . Without loss of generality, assume equality holds (we can just increase ). We have . Then
(Because we are considering collison probabilities, we can ignore the cases when only one of lies in ). The last line is minimized when , thus we have
So by the first claim
and we have , . Then by the second claim, is -quasirandom.
More Powerful Extractors
There are more effective techniques than the leftover lemma [SZ94]. Let be a distribution on a finiste set and define
For example, the min-entropy of a point distribution is zero, and for the uniform distribution , it is .
Now suppose is a set with . Then . Thus we see that implies that for all we have . Sometimes the distribution is referred to as a -source. It turns out that it is possible to extract about bits from an arbitrary -source.
Theorem: For any , and , there exists a family of hash functions
such that
-
(only bits are needed to describe the family)
-
For any distribution on with , the distribution is -quasirandom
The theorem is used to construct cryptosystems with exposure-resilience: even if an adversary learns "crazy" bits of a key, security is still maintained. The idea is to split a key into two parts, the first part specifies the hash function to use while the other bits are fed into the hash function.