优点和RNGCryptoServiceProvider的利弊

编程入门 行业动态 更新时间:2024-10-27 12:34:15
本文介绍了优点和RNGCryptoServiceProvider的利弊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

什么是使用了 System.Security.Cryptography.RNGCryptoServiceProvider 利弊VS System.Random 。我知道, RNGCryptoServiceProvider 是更随机,即少predictable黑客。任何其他的优点或缺点是什么?

What are the pros and cons of using System.Security.Cryptography.RNGCryptoServiceProvider vs System.Random. I know that RNGCryptoServiceProvider is 'more random', i.e. less predictable for hackers. Any other pros or cons?

更新:

据的响应,这里使用的利弊 RNGCryptoServiceProvider 至今:

According to the responses, here are the pros and cons of using RNGCryptoServiceProvider so far:

  • RNGCryptoServiceProvider 是一个强大的加密随机数,这意味着这将是确定加密密钥和喜欢更好。
  • RNGCryptoServiceProvider is a stronger cryptographically random number, meaning it would be better for determining encryption keys and the likes.
  • 随机速度更快,因为它是一个简单的计算;在模拟或长计算时的密码随机性并不重要使用时,这应该被使用。
  • Random is faster because it is a simpler calculation; when used in simulations or long calculations where cryptographic randomness isn't important, this should be used.
推荐答案

一个保密性强的RNG会慢一些 - 它需要更多的计算---并且将频谱白色的,但不会像适合模拟或蒙特卡罗方法,一方面是因为他们的执行的花费更多的时间,因为他们可能不重复,这是很好的测试。

A cryptographically strong RNG will be slower --- it takes more computation --- and will be spectrally white, but won't be as well suited to simulations or Monte Carlo methods, both because they do take more time, and because they may not be repeatable, which is nice for testing.

在一般情况下,你想,当你想要一个唯一的号码如UUID,或作为一个密钥进行加密,并确定PRNG的速度和模拟用密码学的PRNG。

In general, you want to use a cryptographic PRNG when you want a unique number like a UUID, or as a key for encryption, and a deterministic PRNG for speed and in simulation.

更多推荐

优点和RNGCryptoServiceProvider的利弊

本文发布于:2023-11-13 23:31:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585615.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:利弊   优点   RNGCryptoServiceProvider

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!