I am attempting to store an md5 hash of a password in a mysql table.
here's the code to generate the hash:
Dim md5Hasher as New MD5CryptoServiceProvider()
Dim hashedBytes as Byte()
Dim encoder as New UTF8Encoding()
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(somestring.text))
This produces a byte array. What is the best method of storing this byte array in mysql? Do I have to convert this to a string somehow then save? The perferred solution would be to save this in a binary field type. I'm certain this won't work..
Dim paramPwd as mysqlSqlParameter
paramPwd = New mySqlParameter("@Password", SqlDbType.Binary, 16)
paramPwd.Value = hashedBytes
storing asp.net md5 byte array in mysql
Re: storing asp.net md5 byte array in mysql
You specified the correct code cut but it is incomplete. It is not known what command you execute. Please see our Picture demo project. It demonstrates how to store binary data in database, in particular pictures.