我正在寻找比 MD5 更好的加密方法。它必须是单向加密,因为我不想在加密中使用 key 。
最佳答案
基本上MD5是哈希算法而不是加密。 你可以使用更稳定的SHA1
using(System.Security.Cryptography.SHA1 hash = System.Security.Cryptography.SHA1.Create())
{
System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
byte[] combined = encoder.GetBytes(str);
hash.ComputeHash(combined);
}
编辑:回复评论
System.Security.Cryptography.SHA1 Class
The hash is used as a unique value of fixed size representing a large amount of data. Hashes of two sets of data should match if the corresponding data also matches. Small changes to the data result in large, unpredictable changes in the hash.
The hash size for the SHA1 algorithm is 160 bits.
关于c# - 有比 MD5 更好的加密方法吗? (。网),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7024365/