C#中的SHA1 / SHA256 / SHA384 / SHA512或MD5?(哪一个速度更快) [英] SHA1/SHA256/SHA384/SHA512 or MD5 in C#?(Which One is Better in Speed)
问题描述
嗨
我正处于对哈希算法做出决定的情况。我只需要使用托管算法。我需要更新数据库中所有项目的哈希码。数据库包含近十万行,每行应该用新的哈希码更新。
所以在这里我很震惊做出决定,哪个是最好的解决方案。就像
我需要使用哪种算法SHA1 / SHA256 / SHA384 / SHA512或MD5。所以任何人都可以重播我的SHA1 / SHA256 / SHA384 / SHA512或MD5的优点和缺点
i将能够选择任何一种算法。
i已经调整了查询,但没有用,我没有任何相关信息,所以请提供完美的信息。
谢谢
Siva
Hi
I am in situation to take decision on Hash algorithm. i need to use only managed algorithm. just i need to update the hash-code for all the items in database. database contain nearly lakhs of rows, each row should be updated by new hashcode.
So here i was struck to take a decision , Which was best solution to use . just like
Which algorithm i need to use SHA1/SHA256/SHA384/SHA512 or MD5 . So can anybody replay me with the advantages and disadvantages of SHA1/SHA256/SHA384/SHA512 or MD5
i will be able to pick any one of the algorithm.
i had already goggled the query , but no use, i had not got any related information, so please provide me the perfect information.
Thanks
Siva
推荐答案
Hello Siva
MD5并不像SHA那样安全,因为它已被证实在几个被破坏的情况下。
你可以使用 SHA-2 ,因为在SHA-1中发现了缺陷。
SHA-2有不同的类型。您声明的位值(例如256和512)是更受欢迎的值。任何一个都应该适合密码散列。但是,如果哈希所需的时间不是问题,SHA-512可能是首选(仅?)。
干杯,
Edo
Hello Siva
MD5 is not really as secure as SHA as it has been proven in several cases where it was breached.
You could use SHA-2 as flaws have been found in SHA-1.
SHA-2 has different types. The bit values you state (eg 256 and 512) are the more popular ones. Either one should be good for password hashing. However, SHA-512 can be preferred (only?) if the time it takes to hash is not an issue.
Cheers,
Edo
请参阅这些链接。你会对各种因素有更好的了解。
比较哈希算法:Md5,Sha1或Sha2
MD5与SHA-1,性能&谱系
SHA1优于md5仅因为它生成160位的散列
Refer to these links. You will get better idea on various factors.
Comparing Hash Algorithms: Md5, Sha1 or Sha2
MD5 vs. SHA-1, Performance & Pedigree
Is SHA1 better than md5 only because it generates a hash of 160 bits
这篇关于C#中的SHA1 / SHA256 / SHA384 / SHA512或MD5?(哪一个速度更快)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!