H
Henry C. Wu
Hi, I'm trying to implement a way to security check the Hash of the
Application.ExecutablePath. I placed the following ran the ff
procedure at Sub Main
Private Sub CheckHash()
Dim fs As New System.IO.FileStream(Application.ExecutablePath,
System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim shaM As New System.Security.Cryptography.SHA512Managed
Dim bt As Byte() = shaM.ComputeHash(fs)
Console.WriteLine(BitConverter.ToString(bt))
Dim test As String =
"68-B4-A8-E1-FB-A7-5A-76-A9-26-4E-71-F1-7F-1F-93-9F-74-AF-6F-80-A4-A1-AC-34-89-11-8E-43-E7-34-77-BD-B4-6F-1C-B9-C3-F7-29-63-DD-EA-1C-FF-93-6E-18-49-1C-D2-9C-42-10-FD-0D-C3-AC-E5-42-D5-44-9E-E4"
If BitConverter.ToString(bt) = test Then
MsgBox("Same")
Else
MsgBox("Not The same")
End If
fs.Close()
End Sub
My problem is that whenever I generate the Hash value for
MyApplication.exe and store it at Dim test As String ="....." the
value of BitConverter.ToString(bt) changes, thus it would not match no
matter what I do.
Any insights on how to check the MyApplication.exe executable on
StartUp?
Thanks,
Henry
Application.ExecutablePath. I placed the following ran the ff
procedure at Sub Main
Private Sub CheckHash()
Dim fs As New System.IO.FileStream(Application.ExecutablePath,
System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim shaM As New System.Security.Cryptography.SHA512Managed
Dim bt As Byte() = shaM.ComputeHash(fs)
Console.WriteLine(BitConverter.ToString(bt))
Dim test As String =
"68-B4-A8-E1-FB-A7-5A-76-A9-26-4E-71-F1-7F-1F-93-9F-74-AF-6F-80-A4-A1-AC-34-89-11-8E-43-E7-34-77-BD-B4-6F-1C-B9-C3-F7-29-63-DD-EA-1C-FF-93-6E-18-49-1C-D2-9C-42-10-FD-0D-C3-AC-E5-42-D5-44-9E-E4"
If BitConverter.ToString(bt) = test Then
MsgBox("Same")
Else
MsgBox("Not The same")
End If
fs.Close()
End Sub
My problem is that whenever I generate the Hash value for
MyApplication.exe and store it at Dim test As String ="....." the
value of BitConverter.ToString(bt) changes, thus it would not match no
matter what I do.
Any insights on how to check the MyApplication.exe executable on
StartUp?
Thanks,
Henry