Randomness extractor

A randomness extractor, often simply called an "extractor", is a function, which being applied to output from a weakly random entropy source, together with a short, uniformly random seed, generates a highly random output that appears independent from the source and uniformly distributed. Examples of weakly random sources include radioactive decay or thermal noise; the only restriction on possible sources is that there is no way they can be fully controlled, calculated or predicted, and that a lower bound on their entropy rate can be established. For a given source, a randomness extractor can even be considered to be a true random number generator (TRNG); but there is no single extractor that has been proven to produce truly random output from any type of weakly random source.
Sometimes the term "bias" is used to denote a weakly random source's departure from uniformity, and in older literature, some extractors are called unbiasing algorithms, as they take the randomness from a so-called "biased" source and output a distribution that appears unbiased. The weakly random source will always be longer than the extractor's output, but an efficient extractor is one that lowers this ratio of lengths as much as possible, while simultaneously keeping the seed length low. Intuitively, this means that as much randomness as possible has been "extracted" from the source.
Note that an extractor has some conceptual similarities with a pseudorandom generator (PRG), but the two concepts are not identical. Both are functions that take as input a small, uniformly random seed and produce a longer output that "looks" uniformly random. Some pseudorandom generators are, in fact, also extractors. (When a PRG is based on the existence of hard-core predicates, one can think of the weakly random source as a set of truth tables of such predicates and prove that the output is statistically close to uniform.) However, the general PRG definition does not specify that a weakly random source must be used, and while in the case of an extractor, the output should be statistically close to uniform, in a PRG it is only required to be computationally indistinguishable from uniform, a somewhat weaker concept.
NIST Special Publication 800-90B (draft) recommends several extractors, including the SHA hash family and states that if the amount of entropy input is twice the number of bits output from them, that output can be considered essentially fully random.
Formal definition of extractors.
The min-entropy of a distribution formula_1 (denoted formula_2), is the largest real number formula_3 such that formula_4 for every formula_5 in the range of formula_1. In essence, this measures how likely formula_1 is to take its most likely value, giving a worst-case bound on how random formula_1 appears. Letting formula_9 denote the uniform distribution over formula_10, clearly formula_11.
For an "n"-bit distribution formula_1 with min-entropy "k", we say that formula_1 is an formula_14 distribution.
Definition (Extractor): ("k", "ε")-extractor
Let formula_15
be a function that takes as input a sample from an formula_14 distribution formula_1 and a "d"-bit seed from formula_18, and outputs an "m"-bit string.
formula_19 is a ("k", "ε")-extractor, if for all formula_14 distributions formula_1, the output distribution of formula_19 is "ε"-close to formula_23.
In the above definition, "ε"-close refers to statistical distance.
Intuitively, an extractor takes a weakly random "n"-bit input and a short, uniformly random seed and produces an "m"-bit output that looks uniformly random. The aim is to have a low formula_24 (i.e. to use as little uniform randomness as possible) and as high an formula_25 as possible (i.e. to get out as many close-to-random bits of output as we can).
Strong extractors.
An extractor is strong if concatenating the seed with the extractor's output yields a distribution that is still close to uniform.
Definition (Strong Extractor): A formula_26-strong extractor is a function
such that for every formula_14 distribution formula_1 the distribution formula_30 (the two copies of formula_18 denote the same random variable) is formula_32-close to the uniform distribution on formula_33.
Explicit extractors.
Using the probabilistic method, it can be shown that there exists a ("k", "ε")-extractor, i.e. that the construction is possible. However, it is usually not enough merely to show that an extractor exists. An explicit construction is needed, which is given as follows:
Definition (Explicit Extractor): For functions "k"("n"), "ε"("n"), "d"("n"), "m"("n") a family Ext = {Ext"n"} of functions
is an explicit ("k", "ε")-extractor, if Ext("x", "y") can be computed in polynomial time (in its input length) and for every "n", Ext"n" is a ("k"("n"), "ε"("n"))-extractor.
By the probabilistic method, it can be shown that there exists a ("k", "ε")-extractor with seed length
and output length
Dispersers.
A variant of the randomness extractor with weaker properties is the disperser.
Randomness extractors in cryptography.
One of the most important aspects of cryptography is random key generation. It is often necessary to generate secret and random keys from sources that are semi-secret or which may be compromised to some degree. By taking a single, short (and secret) random key as a source, an extractor can be used to generate a longer pseudo-random key, which then can be used for public key encryption. More specifically, when a strong extractor is used its output will appear be uniformly random, even to someone who sees part (but not all) of the source. For example, if the source is known but the seed is not known (or vice versa). This property of extractors is particularly useful in what is commonly called Exposure-Resilient cryptography in which the desired extractor is used as an Exposure-Resilient Function (ERF). Exposure-Resilient cryptography takes into account that the fact that it is difficult to keep secret the initial exchange of data which often takes place during the initialization of an encryption application e.g., the sender of encrypted information has to provide the receivers with information which is required for decryption.
The following paragraphs define and establish an important relationship between two kinds of ERF--k"-ERF and k"-APRF--which are useful in Exposure-Resilient cryptography. 
Definition ("k"-ERF): "An adaptive k-ERF is a function" formula_37 "where, for a random input" formula_38 ", when a computationally unbounded adversary" formula_39 "can adaptively read all of" formula_38 "except for" formula_3 "bits," formula_42 "for some negligible function" formula_43 (defined below).
The goal is to construct an adaptive ERF whose output is highly random and uniformly distributed. But a stronger condition is often needed in which every output occurs with almost uniform probability. For this purpose Almost-Perfect Resilient Functions (APRF) are used. The definition of an APRF is as follows:
Definition (k-APRF): "A" formula_44 "APRF is a function" formula_37 "where, for any setting of" formula_46 "bits of the input" formula_38 "to any fixed values, the probability vector" formula_48 "of the output" formula_49 "over the random choices for the" formula_3 "remaining bits satisfies" formula_51 "for all" formula_52 "and for some negligible function" formula_43.
Kamp and Zuckerman have proved a theorem stating that if a function formula_37 is a "k"-APRF, then formula_37 is also a "k"-ERF. More specifically, "any" extractor having sufficiently small error and taking as input an "oblivious", bit-fixing source is also an APRF and therefore also a "k"-ERF. A more specific extractor is expressed in this lemma:
Lemma: "Any" formula_56"-extractor" formula_57 "for the set of" formula_58 "oblivious bit-fixing sources, where" formula_43 "is negligible, is also a k-APRF."
This lemma is proved by Kamp and Zuckerman. The lemma is proved by examining the distance from uniform of the output, which in a formula_56-extractor obviously is at most formula_56, which satisfies the condition of the APRF.
The lemma leads to the following theorem, stating that there in fact exists a "k"-APRF function as described:
Theorem (existence): "For any positive constant" formula_62", there exists an explicit k-APRF" formula_63", computable in a linear number of arithmetic operations on" formula_25"-bit strings, with" formula_65 "and" formula_66.
Definition (negligible function): In the proof of this theorem, we need a definition of a negligible function. A function formula_43 is defined as being negligible if formula_68 for all constants formula_69.
Proof:
Consider the following formula_32-extractor: The function formula_37 is an extractor for the set of formula_72 oblivious bit-fixing source: formula_63. formula_37 has formula_75, formula_76 and formula_77.
The proof of this extractor's existence with formula_78, as well as the fact that it is computable in linear computing time on the length of formula_25 can be found in the paper by Jesse Kamp and David Zuckerman (p. 1240).
That this extractor fulfills the criteria of the lemma is trivially true as formula_76 is a negligible function.
The size of formula_25 is:
Since we know formula_78 then the lower bound on formula_25 is dominated by formula_85. In the last step we use the fact that formula_62 which means that the power of formula_85 is at most formula_88. And since formula_85 is a positive integer we know that formula_90 is at most formula_85.
The value of formula_3 is calculated by using the definition of the extractor, where we know:
and by using the value of formula_25 we have:
Using this value of formula_25 we account for the worst case, where formula_3 is on its lower bound. Now by algebraic calculations we get:
Which inserted in the value of formula_3 gives
which proves that there exists an explicit k-APRF extractor with the given properties. formula_103
Examples.
Von Neumann extractor.
Perhaps the earliest example is due to John von Neumann. From the input stream, his extractor took bits, two at a time (first and second, then third and fourth, and so on). If the two bits matched, no output was generated. If the bits differed, the value of the first bit was output. The Von Neumann extractor can be shown to produce a uniform output even if the distribution of input bits is not uniform so long as each bit has the same probability of being one and there is no correlation between successive bits.
Thus, it takes as input a Bernoulli sequence with not necessarily equal to 1/2, and outputs a Bernoulli sequence with formula_104
More generally, it applies to any exchangeable sequence—it only relies on the fact that for any pair, 01 and 10 are "equally" likely: for independent trials, these have probabilities formula_105, while for an exchangeable sequence the probability may be more complicated, but both are equally likely.
Chaos machine.
Another approach is to use the output of a chaos machine applied to the input stream. This approach generally relies on properties of chaotic systems. Input bits are pushed to the machine, evolving orbits and trajectories in multiple dynamical systems. Thus, small differences in the input produce very different outputs. Such a machine has a uniform output even if the distribution of input bits is not uniform or has serious flaws, and can therefore use weak entropy sources. Additionally, this scheme allows for increased complexity, quality, and security of the output stream, controlled by specifying three parameters: "time cost", "memory required", and "secret key".
Cryptographic hash function.
It is also possible to use a cryptographic hash function as a randomness extractor. However, not every hashing algorithm is suitable for this purpose.
Applications.
Randomness extractors are used widely in cryptographic applications, whereby a cryptographic hash function is applied to a high-entropy, but non-uniform source, such as disk drive timing information or keyboard delays, to yield a uniformly random result.
Randomness extractors have played a part in recent developments in quantum cryptography, where photons are used by the randomness extractor to generate secure random bits.
Randomness extraction is also used in some branches of computational complexity theory.
Random extraction is also used to convert data to a simple random sample, which is normally distributed, and independent, which is desired by statistics.