哪些平台提供 SystemRandom?

发布于 2024-11-13 04:25:22 字数 105 浏览 9 评论 0原文

Python 的 random.SystemRandom 提供加密质量的伪随机数。它支持哪些平台?最重要的是,是否有任何平台不支持它,如果是,是哪些平台?任何人都可以提供有关其便携性的任何信息吗?

Python's random.SystemRandom provides cryptographic-quality pseudorandom numbers. What platforms is it supported on? Most importantly, are there any platforms that it is not supported on, and if so, which ones? Can anyone provide any information about how portable it is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街九尾狐 2024-11-20 04:25:23

来自 http://docs.python.org/library/random.html

random 模块还提供了 SystemRandom 类,该类使用系统函数 os.urandom() 从操作系统提供的源生成随机数。

来自 http://docs.python.org/library/os.html#os。乌兰多姆

此函数从操作系统特定的随机源返回随机字节。返回的数据对于加密应用程序来说应该是足够不可预测的,尽管其确切质量取决于操作系统的实现。在类 UNIX 系统上,这将查询 /dev/urandom,在 Windows 上,它将使用 CryptGenRandom。如果未找到随机源,则会引发 NotImplementedError

From http://docs.python.org/library/random.html

The random module also provides the SystemRandom class which uses the system function os.urandom() to generate random numbers from sources provided by the operating system.

From http://docs.python.org/library/os.html#os.urandom

This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. On a UNIX-like system this will query /dev/urandom, and on Windows it will use CryptGenRandom. If a randomness source is not found, NotImplementedError will be raised.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文