My approach is the following:
- I am creating a
Uint8Arraywith the desired length.
- I am using
Math.random()to prefill it.
- I am showing a a 256x256pixel box, and show a message asking for moving the mouse around in it. For every
onmousemoveevent, I am selecting a random byte in the array (using
Math.randomagain), and doing a bitwise XOR with the relative X position of the mouse cursor, and doing the same to another random byte, with the Y position.
- I keep processing
onmousemoveevents until N events have been processed. (N >= a lot)
So what I have in the end is an array that was prefilled by an insecure random number generator, but whose output was mixed around with a lot of user-generated entropy.
My question is: Would the resulting number be safe to use? Or am I missing some glaring insecurity in this approach?