且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

利用Sandy Bridge的硬件真正的随机数生成器?

更新时间:2023-02-06 09:03:20

Intel已发布了有关以下内容的手册,库和代码示例rdrand 指令软件实施指南 rel = noreferrer> http://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide 。

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.

自述文件:


因为许多编译器工具链不为了支持这一新指令,该库是为方便访问而创建的
。这个想法很简单:链接到内置的静态库并享受新功能!

"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!"

main.c 中有所有库调用的示例。

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

我能够在Mac OS X上的gcc中编译静态库和测试程序。文档指出它也与Linux和Windows。

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.

请注意, rdrand 实际上是一个128位的伪随机数生成器,其硬件产生的熵。 (即将推出的Broadwell架构将提供 rdseed 指令来访问真正的随机数生成器。)差异的详细信息及其含义可在 Long Answer标题下找到。在 http:// software.intel.com/zh-CN/blogs/2012/11/17/the-difference-between-rdrand-and-rdseed

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.