I am getting a bit confused with the PRGs employed in cryptography.
Basically, a PRG is used to expand a random sequence (mostly a key) of length s to a length n>s, still looking random. Now while this is obviously not possible in a mathematical sense, the idea is that we achive reasonable randomness, meaning that an efficient distinguisher cannot tell the larger sequence apart from random (so we achieve randomness in a computational sense). My question is do we really?
Consider this example:
Input: k: {0,1}^2
PRG G: {0,1}^2 -> {0,1}^4
Output: k' = G(k) : {0,1}^4
This means our initial key can take on 4 possible values. Allthough our derived key covers a range of 16 values, it can only take on 4 out of these 16 values, since the PRG is deterministic. So what hinders me from mapping possible initial keys to output keys as an attack? I would thereby be able to reduce the search space from 16 to 4 values. So basically invert the expansion?
I would now argue that we do not achieve any expansion of randomness, as long as we have memory to store these mappings. Since there are some PRGs which are commonly used, this would provide an incentive for collaborative projects to map all or at least part of the keys to break security for many applications.
I am certain that I must have gotten something wrong above, but I cannot figure out where my error lies. Could you please help?
Many Thanks