/dev/random Extremely Slow?

后端 未结 6 821
情深已故
情深已故 2020-12-01 06:23

Some background info: I was looking to run a script on a Red Hat server to read some data from /dev/random and use the Perl unpack() command to convert it to a hex string fo

6条回答
  •  忘掉有多难
    2020-12-01 06:38

    use /dev/urandom, its cryptographically secure.

    good read: http://www.2uo.de/myths-about-urandom/

    "If you are unsure about whether you should use /dev/random or /dev/urandom, then probably you want to use the latter."

    When in doubt in early boot, wether you have enough entropy gathered. use the system call getrandom() instead. [1] (from Linux kernel >= 3.17) Its best of both worlds,

    • it blocks until (only once!) enough entropy is gathered,
    • after that it will never block again.

    [1] git kernel commit

提交回复
热议问题