2
$\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$
1
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – SEJPM
    Commented Feb 14, 2019 at 13:21

2 Answers 2

2
$\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$
1
  • 1
    $\begingroup$ Big state xorshift doesn't meet the requirement for different streams. $\endgroup$
    – Thorham
    Commented Feb 14, 2019 at 12:28
2
$\begingroup$

JP Aumasson has created the Blabla generator, based on BLAKE2b (64-bit), which is very similar to Chacha/Salsa.

In my tests, it does not seem vastly faster than concatenating two consecutive outputs of Chacha.

https://github.com/veorq/blabla/blob/master/BlaBla.swift

$\endgroup$

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.