3 ms·
if it needs to be the same, or repeatable, you don't actually want a random function, you want a hash function. might as well call it such.
by somat 5y ago
if it needs to be the same, or repeatable, you don't actually want a random function, you want a hash function. might as well call it such.
- JoachimS 5y agoNo. The PRNG does not take an arbitrary large input and generates a digest/checksum. The PRNG accepts a single (short) input - a seed used to set the initial state. And can then generate a large number of values by updating the state. This is almost the opposite of a hash function. You could build the state update function using a hash function. But that does not make the PRNG a hash function.
- charcircuit 5y ago>This is almost the opposite of a hash function. I would hesitate to say that. Look at hash functions built upon a sponge construction. One way to describe a sponge is that it absorbs a seed and then you can squeeze out random numbers. When building a hash function you absorb the input data and just squeeze out N bytes.
- JoachimS 5y agoYes, and no. The Sponge function in this context operates as a eXtended Output Function. It has an internal state and a state update function. But it does not in this context absorb a large input and output a digest. Sponges as a kernel/function that can be used to build hash functions, XOFs, PRNGs are interesting. That does not make the OP general statement that a PRNG should be called a hash function more correct. At least IMHO.
- charcircuit 5y agoI am only pointing out the similarities between hash functions and PRNGs. I was not trying to disagree with your main point that a PRNG is a hash function. Though perhaps you could call them opposites in that usually you have a fixed input and infinite output for a PRNG and an infinite input and a fixed output for hash functions.
- deleted 5y ago[deleted]