Pseudorandom generators (PRG) are functions that takes a random small input (called the Seed) and maps it into much larger output .

However, the mapping process must be unpredictable in order for the PRG to be used securely in cryptography.

My question is: Are there any tool the does the opposite? i.e. takes a long random string and maps it to a smaller random unpredictable output?

And if not, can we use s-box for this purpose?

  • 6
    A hash function?
    – user10211
    Jul 25, 2014 at 12:44
  • 2
    @HSN — what's the use case for this?
    – Joel L
    Jul 25, 2014 at 13:19
  • 1
    Unless I miss something, you just described a cryptographic hash. Jul 25, 2014 at 13:26

2 Answers 2


It seems to me a cryptographic hash, such as the SHA family, would do what you are describing. If not perhaps you could clarify your question.

  • Correct. Hash functions can actually be used as a random extractor (see NIST SP 800-90B). NIST however requires that you put in twice as much entropy as the output of the hash function (to call it fully randomized). Of course, if you already have a well seeded CSPRNG you can just take the amount of bytes you require for all practical purposes. Jul 29, 2014 at 11:42

PRG do not really map something small to something big. Seed and numbers are often of the same size. Also they are not unpredictable but deterministic for a given seed. Only the sequence of numbers the PRG creates is "random".

Anyway, if you need a function where you put in something big and get a smaller result where you can not simply revert the process, you are probably looking for a hashing function.

But maybe you need to tell us more about what you like to do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .