让我对加密技术知之甚少,我试图找到在某些vb.net winform
应用程序中散列用户密码的最佳方法;然后将其存储在在线mysql
分贝。 我发现了很多有关该主题的帖子,但无法弄清楚哪一个是最好的方法。什么是最新的密码哈希算法/数据加密为MySQL?
我到达this MSDN post但仍不能确定我是否可以使用它。
我不能在哪里输入一些随机密钥,它是由函数自动生成的。
所以我的问题是,这是一个密码哈希的固体功能? 任何替代品?
谢谢
代码:
Imports System Imports System.IO Imports System.Security.Cryptography Class AesExample Public Shared Sub Main() Try Dim original As String = "Here is some data to encrypt!" ' Create a new instance of the Aes ' class. This generates a new key and initialization ' vector (IV). Using myAes As Aes = Aes.Create() ' Encrypt the string to an array of bytes. Dim encrypted As Byte() = EncryptStringToBytes_Aes(original, myAes.Key, myAes.IV) ' Decrypt the bytes to a string. Dim roundtrip As String = DecryptStringFromBytes_Aes(encrypted, myAes.Key, myAes.IV) 'Display the original data and the decrypted data. Console.WriteLine("Original: {0}", original) Console.WriteLine("Round Trip: {0}", roundtrip) End Using Catch e As Exception Console.WriteLine("Error: {0}", e.Message) End Try End Sub 'Main Shared Function EncryptStringToBytes_Aes(ByVal plainText As String, ByVal Key() As Byte, ByVal IV() As Byte) As Byte() ' Check arguments. If plainText Is Nothing OrElse plainText.Length
太谢谢你了@zap h,如果你可以发布一个链接到vb.net的实现,那会很棒。谢谢 – wpcoder
.NET [Rfc2898DeriveBytes](https://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc2898derivebytes(v = vs.110).aspx),是PBKDF2它只是MS喜欢添加混乱。 – zaph