1
$\begingroup$

Can I use ChaCha with four rounds as a good non-cryptographic PRNG with different streams if I use 64 bit integers instead of the standard 32 bit integers? I need a bigger state and this seems the easiest way to do it.

$\endgroup$
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – SEJPM Feb 14 at 13:21
1
$\begingroup$

The BLAKE and BLAKE2 cryptographic hash functions use a modified version of the ChaCha quarter round in a HAIFA construction. The modified round function uses a 64-bit word size and has adjusted rotation constants (32, 25, 16, and 11 for BLAKE, and 32, 24, 16, and 63 for BLAKE2.). It's likely that all you'd need to do is use that primitive to construct a 64-bit version of the stream cipher, increasing the number of rounds as necessary to allow for sufficient diffusion. Of course, this construction could easily be fatally broken, and you should never roll your own crypto. However, it appears that this would be sufficient for a non-cryptographic PRNG if it meets all your randomness requirements.

If all you need is a non-cryptographic PRNG, you'd likely be better off using a dedicated high-speed PRNG that is capable of performing well on 64-bit architectures, assuming that is the primary reason you wish to operate on those word sizes. Various versions of XorShift should fit the bill. A large seed state can be compressed using a hash function, so there is no need to modify the algorithm.

$\endgroup$
  • $\begingroup$ Big state xorshift doesn't meet the requirement for different streams. $\endgroup$ – Thorham Feb 14 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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