Generate random numbers with mouse input

Registered by aj00200

Create a method to get random numbers via mouse and keyboard input.

Discuss:
 - research how other software does this
 - how to handle the fact that the mouse will leave a trail
 - how to handle the mouse being out of our capture bounds

Blueprint information

Status:
Started
Approver:
CryoJS Developers
Priority:
Low
Drafter:
hexafraction
Direction:
Approved
Assignee:
hexafraction
Definition:
Drafting
Series goal:
None
Implementation:
Started
Milestone target:
None
Started by
hexafraction

Sprints

Whiteboard

I would, personally, capture mouse movements using an onmousemove event to get the values of window.event.clientX and window.event.clientY, and to feed said values into a SHA512 generator, taking the first 256 bits for reasons of keeping a random pool unknown. This may be repeated along the following algorithm:

1.Generate pseudo-random number
2.SHA512 it
3.XOR in mouse coordinates(repeating the same 32-bit integer of (65536*mouseX)+mouseY) upon a mouse movement
4. SHA512 again
5. Use 256 least-significant bits of last hashes (using as many hashes as necessary, but never revealing the most significant bits to keep a pool unknown to attackers)
6. Upon finishing random data collection, keep said key made from last whatever hashes
This will avoid the trouble of the mouse being out of bounds since few users have a 65535x65535 pixel window, and the hash will ensure that even small movements will cause great changes(Avalanche Effect)

-Robert Arkenin (https://launchpad.net/~rarkenin)

Another (easier) method to keep track of 256-bit blocks is to write sequentially to each block of the final key, looping around and overwriting as necessary. This does NOT lower security, while it does make the code easier to handle.

I'm taking over this ---rarkenin

Returning data to main script is postponed as I need to know about main script implementation first

I think you would want to create a UI element to cover the entire page to show the user that data is being captured. I have not looked into it yet, but I think we will need a "big number" JavaScript library to work with larger numbers. We will probably need to use that with the returned data to hopefully return a complete random number (i.e. "big number object") which is x bits in length.

We don't need bigint right now... Is the data to be returned as a string of hexits? Then you can use string concat...

Ok, that would work.

(?)

Work Items

Work items:
Create infomation box for user to see when enough mouse movements have been generated: INPROGRESS
Perform hashing to get secure random data: TODO
Return data to main script: POSTPONED

This blueprint contains Public information 
Everyone can see this information.