Scenario: I created a software that calculates the hash of a file, and compares it to a hash list file in my possession (about 1 mln - growing), currently in txt format. Which is the best way to make the comparison as fast as possibile?
I'm using this function:
Public HashList As New List(Of String)
Private Sub LoadHash()
For Each hash As String In IO.File.ReadAllLines("C:\test\hash.txt")
HashList.Add(hash)
Next
End Sub
Private Function CheckFile(ByVal filename As String) As Boolean
If HashList.Contains(MD5(filename)) Then
Return True
End If
Return False
End Function
Any suggestions for improve this code? are there better methods?