Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Combine the time with some other incremental hard-to-predict inputs.

Start with the time, in the milliseconds (not seconds, i.e. epoch time). Use that seed to create a random number. That random number is now your master_seed.

Once every 10 seconds, measure the temperature of the CPU, and every other temperature sensor in the system, and put that into a new random seed. Create a random number using this seed. XOR it with the mast_seed and store it as the new masted_seed.

Every time someone moves a mouse, use the timestamp and the pixel offset to update the master_seed similarly as above.

Every time a packet comes into the ethernet interface, use the timestamp and a hash of the packet contents, and update the random seed.

XOR the contents of the video buffer.

Track the timing of keyboard clicks.

There are lots of sources of entropy that you can use to make the seed effectively unguessable.



just like anything else with cryptography, please don't roll your own. all major OSes and programming languages provide primitives to generate cryptographically strong random numbers- use that instead.


Yes!

I was hoping to illustrate the the grandparent post where more entropy can come from.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: