dimanche 10 mars 2019

Is there a optimal batch size for arc4random_buf?

I need billions of random bytes from arc4random_buf, and my strategy is to request X random bytes at a time, and repeat this many times.

My question is how large should X be. Since the nbytes argument to arc4random_buf can be arbitrarily large, I suppose there must be some kind of internal loop that generates some entropy each time its body is executed. Say, if X is a multiple of the number of random bytes generated each iteration, the performance can be improved because I’m not wasting any entropy.

I’m on macOS, which is unfortunately closed-source, so I cannot simply read the source code. Is there any portable way to determine the optimal X?




Aucun commentaire:

Enregistrer un commentaire