I have a few lines of code here from a sample project.
Function md5_hash(ByVal file_name As String)
Return hash_generator("md5", file_name)
End Function
Function hash_generator(ByVal hash_type As String, ByVal file_name As String)
Dim hash
hash = MD5.Create
Dim hashValue() As Byte
Dim filestream As FileStream = File.OpenRead(file_name)
filestream.Position = 0
hashValue = hash.ComputeHash(filestream)
Dim hash_hex = PrintByteArray(hashValue)
filestream.Close()
Return hash_hex
End Function
Private Sub BunifuThinButton21_Click(sender As Object, e As EventArgs) Handles BunifuThinButton21.Click
Dim path As String = OpenFileDialog1.FileName
Dim sample As String
sample = md5_hash(path)
End Sub
As you can see in this code, an OpenFileDialog was used to declare the path of the file that is being checked to see if it has an MD5 hash matching a database of MD5 hashes.
Now, in my program, I have a FileSystemWatcher which is supposed to monitor all of the files being opened by the user, but I can't seem to be able to create that function, because I'm not sure if there's a way to declare the file for 'path' when it's being opened.
How do you do this?
Leave any questions below, and I'll do my best to talk to you about it. I'm only a beginner at VB.net, so I've been trying my best to find a solution to this.
What I have tried:
Asking questions on other sites.