Making use of sandy bridge's hardware true random number generator?

前端 未结 3 1220
失恋的感觉
失恋的感觉 2020-12-31 12:04

I was wondering if there is a way to make use of the new hardware based true number generator found in intel\'s sandy bridge CPU? I read that intel\'s MKL (Math Kernel Libra

3条回答
  •  太阳男子
    2020-12-31 12:26

    Intel has posted a manual, library, and code examples for the rdrand instruction at http://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide.

    From the Readme:

    "Because the many of compiler toolchains do not support this new instruction, this library was created to facilitate easy access to it. The idea is simple: link to a built static library and enjoy the new feature!"

    There are examples of all the library calls in main.c.

    I was able to compile the static library and test program in gcc on Mac OS X. The documentation states that it is also compatible with Linux and Windows.

    Be aware that rdrand is actually a 128-bit pseudo-random number generator with hardware-generated entropy. (The upcoming Broadwell architecture will provide an rdseed instruction to access the true random number generator.) The details of the difference and its implications can be found under the "Long Answer" heading at http://software.intel.com/en-us/blogs/2012/11/17/the-difference-between-rdrand-and-rdseed.

提交回复
热议问题