I need to store the result of MD5 hashing to a database (MS Access) and currently the best option I understand is to convert it to a string and save that. Is there a cleaner way of saving this data?
I start out with the value of hash1 from the following which produces an array of bytes (128 bit)
Dim MyHasher As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim file1 As New FileStream("d:/customer/remcontshop/temp/upload.pdf", FileMode.Open)
Dim hash1 As Byte() = MyHasher.ComputeHash(file1)
lblResult.Text = BitConverter.ToString( hash1 )
The value calculated for lblResult gives me the hash as a 16 bit hex string seperated by hyphens e.g.
I can store this to my database as text but if I can do it in a more efficient way, I'd prefer that.
Ideally I want it in a form where I can query it easily with SQL. e.g.
SELECT * FROM hash_table WHERE hashvalue = "57-D9-95-B8-6F-23-CD-DB-78-E4-A1-10-24-BE-3C-C1"
Any ideas on how to get a more efficient result?