Score:2

Hash function based cryptographically secure pseudo random number generator

cr flag

I once read/heard that one could generate a cryptographically secure pseudo random number generator based on two cryptographically secure hash functions.

The algorithm goes this way:

  • Let $f$ and $g$ be two independant cryptographically secure hash functions of block size $s$.
  • This algorithm outputs blocks of $s$, the block $n$ is defined as: $output[n \times s; (n+1) \times s] = f(g_{n}(seed))$
  • The function $g_{n}(seed)$ is defined as $g_{n} = g_{n-1}(seed)$ where $g_{0}(seed) = g(seed)$.

Concretely, the first block is generated with $f(g(seed))$, the second block with $f(g(g(seed)))$, then $f(g(g(g(seed))))$, and so on...

I've been looking around for any paper, or anybody mentioning this algorithm and/or trying to do cryptanalysis of this algorithm, but I haven't found anything.

Cryptographically strong seeded pseudo random number generator suggests the same algorithm, but only uses one hash function contrary to what I'm suggesting. The selected answer says to use two hash functions, but I couldn't find more details in the literature.

Is this algorithm real? What is the name of it?

kelalaka avatar
in flag
A couple of examples [Can a cryptographic hash be used as a cryptographic RNG?](https://crypto.stackexchange.com/q/25226/18298) . [Using a hash function as a random number generator](https://crypto.stackexchange.com/q/66932/18298), [Would it be secure to generate random number using AES?](https://security.stackexchange.com/q/62877/86735) Where see NIST SP 800-90 for hash (and HMAC) based RNGs
cn flag
The question is what the conditions on $f$ and $g$ are. In general it's clearly false, just choose $f=g$.
Antoine Catton avatar
cr flag
@Maeher I edited the question. The condition on $f$ and $g$ is that they are unrelated/independant from each other.
SEJPM avatar
us flag
If f and f are independent random functions, this shouldn't be tricky to prove. I'm not sure if there's a weaker condition that allows a proof though.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.