如何找到“真实的” std :: random_device的熵? [英] how to find the "true" entropy of std::random_device?

查看:234
本文介绍了如何找到“真实的” std :: random_device的熵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查我的实现 std :: random_device
是否具有非零熵(即是非确定性的),使用 std :: random_device :: entropy()函数。但是,根据
cppreference.com


这个函数在一些标准库中没有完全实现
例如,gcc和clang总是返回零,即使设备
是非-deterministic。相比之下,Visual C ++总是返回32,
和boost.random返回10。


找到真实熵的方法?特别地,现代的
计算机(MacBook Pro / iMac等)具有非确定性源或随机性,例如。使用散热监视器?

解决方案

我建议你参考这篇文章。



关于/ dev / urandom的神话

§26.5.6


random_device均匀随机数生成器生成非确定性随机数字。



如果实施限制阻止生成非确定性随机数,则实施可能会使用随机数字引擎。


所以基本上它会尝试使用内部系统真随机数生成器,在linux / dev / {u} random o windows RltGenRandom。



另一点是你不信任这些随机性源,因为它们依赖于内部噪声或接近实现。



另外,你如何确定熵的质量,因为你知道这是找到好的rng发电机的最大的问题之一。



非常好,其他估计可能报告不那么好的熵。



熵估计




在各种科学/工程应用中,例如独立的
分量分析,图像分析,遗传分析,
识别,流形学习和时间延迟估计有用
估计系统或过程的差分熵,给定
一些观察结果。




因为它是sais,你必须依赖于最终的观察,那些可能是错误的。



我认为内部rng是不够好,你可以随时尝试购买硬件设备的目的。此 wikipedia上的列表包含供应商列表,您可以在互联网上查看相关评论。



性能



您必须考虑的一点是应用程序中使用真实随机数生成器的性能。一种常见的技术是在mersenne twister中使用/ dev / random获得的数字作为种子。



如果用户无法以物理方式访问您的系统,则需要平衡可靠性与可用性,具有安全漏洞的系统就像一个不工作一样糟糕,最后你必须加密你的重要数据。



编辑1:作为建议我已经移动了我的评论顶部的文章,是一个很好的阅读。感谢提示: - )。


I want to check whether my implementation of std::random_device has non-zero entropy (i.e. is non-deterministic), using std::random_device::entropy() function. However, according to cppreference.com

"This function is not fully implemented in some standard libraries. For example, gcc and clang always return zero even though the device is non-deterministic. In comparison, Visual C++ always returns 32, and boost.random returns 10."

Is there any way of finding the real entropy? In particular, do modern computers (MacBook Pro/iMac etc) have a non-deterministic source or randomness, like e.g. using heat dissipation monitors?

解决方案

I recommend you the lecture of this article.

Myths about /dev/urandom

§ 26.5.6

A random_device uniform random number generator produces non-deterministic random numbers.

If implementation limitations prevent generating non-deterministic random numbers, the implementation may employ a random number engine.

So basically it will try to use the internal system "true" random number generator, in linux /dev/{u}random o windows RltGenRandom.

A different point is you don't trust those sources of randomness because they depend on internal noise or are close implementations.

Additionally is how do you meassure the quality of entropy, as you know that is one of the biggest problem trying to find good rng generators.

One estimation could be extremely good and other estimation could report not so good entropy.

Entropy Estimation

In various science/engineering applications, such as independent component analysis, image analysis, genetic analysis, speech recognition, manifold learning, and time delay estimation it is useful to estimate the differential entropy of a system or process, given some observations.

As it sais, you must rely on final observations, and those can be wrong.

I you think the internal rng is not good enough, you can always try to buy hardware devices for that purpose. This list on wikipedia has a list of vendors, you can check on the internet reviews about them.

Performance

One point you must consider is the performance within your application using real random number generators. One common technique is to use as seed in a mersenne twister a number obtained using /dev/random.

If the user can't access your system physically, you will need to balance reliability with availability, a system with security holes is as bad as one doesn't work, at the end you must have your important data encrypted.

Edit 1: As suggestion I have moved the article at the top of my comment, is a good read. Thanks for the hint :-).

这篇关于如何找到“真实的” std :: random_device的熵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆