I want a stateless deterministic pseudorandom generator.

Following number generation is deterministic, whenever I give $constantValue$, and index it will value $A$

$A = Hash(constantValue + index)$

$index$ ranges from $0$ to infinity.

It is a deterministic value generation, but I have to keep state (index) to avoid generation of one value more than once.

My question is how can I make it stateless ( I do not have to keep a right index to avoid generation of one value more than once.)

I want to avoid generating one number (A) more than once I have to keep right index (state).

At the same time, I want value generation to be deterministic.

State here can be considered as---Merkle Signature scheme is stateful signature scheme, but SPHINCS is a stateless signature scheme.

Note that hash and a constant value is mandatory to be part of a pseudorandom generation.

  • $\begingroup$ Possibly you could use time as a universal counter / index. Or use a challenge-response protocol. Or even have a trusted third party to maintain the state or index. But all those solutions would depend on the use case if they are feasible. $\endgroup$
    – Maarten Bodewes
    Mar 9, 2018 at 12:52
  • $\begingroup$ @MaartenBodewes in case I use time as index, that is not deterministic. In order to regenerate, i have to store the time that becomes stateful. $\endgroup$
    – Infinity
    Mar 9, 2018 at 12:55
  • $\begingroup$ Neither of the workarounds above are completely stateless. Probably I should have used that word instead of solutions. However, possibly you wanted some workarounds after reading poncho's answer ;) $\endgroup$
    – Maarten Bodewes
    Mar 9, 2018 at 12:57

1 Answer 1


I want a stateless deterministic pseudorandom generator.

I don't see how that can work.

"Stateless" - the generator is always in the same state

"Deterministic" - given the same state (and inputs, but there's no inputs here), the generator always generates the same output.

Hence, you end up with something that always generates the same output; hardly pseudorandom.

The comparison with SPHINCS doesn't appear to be quite valid; the original SPHINCS is not deterministic (it selects the path through the hypertree randomly); you could make it deterministic (by depending on the message being signed to seed your randomness), but that's making it depend on an input that your pseudorandom number generator doesn't have.

  • $\begingroup$ Is there anything that can be stateless and deterministic at the same time. $\endgroup$
    – Infinity
    Mar 9, 2018 at 13:07
  • $\begingroup$ Of course there is. $0^{len}$ would come to mind, were $len$ is the required output length. It is however not exactly random (it is rather the opposite: it is exactly not random). $\endgroup$
    – Maarten Bodewes
    Mar 9, 2018 at 14:08
  • $\begingroup$ @Infinity: actually, lots of things can be stateless and deterministic, but they take inputs $\endgroup$
    – poncho
    Mar 9, 2018 at 14:10
  • $\begingroup$ can you refer me some article or paper $\endgroup$
    – Infinity
    Mar 9, 2018 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.