![]() |
|
File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 (/Thread-File-Hash-Checker-Verify-Virus-Scans-MD5-SHA1-SHA256) Pages:
1
2
|
File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - BreShiE - 03-02-2013 We all know this major problem of people posting false virus scans, right? The average person doesn't know how to check the hashes on virus scans to verify it's the same program, so here with HashCheckSum you can easily find the file hash to check it against a virus scan! Preview: ![]() Download: http://www.multiupload.nl/1YJ9IGLEKX Virus Scan: https://www.virustotal.com/en/file/3e2c0f0aff67e7c89d0ad513e2134db05b8ced55f2431f9a1066209d244e6b85/analysis/1362246008/ 1/46 false positive RE: MD5 File Hash Checker - Verify Virus Scans! - Oni - 03-02-2013 Not sure if it's clean, but checking the MD5 hash is always a good idea when downloading stuff. RE: MD5 File Hash Checker - Verify Virus Scans! - BreShiE - 03-02-2013 How can you not be sure if it's clean? This is me you're talking about. ¬_¬ v2 Preview: http://puu.sh/2aA0G RE: MD5 File Hash Checker - Verify Virus Scans! - Charon - 03-02-2013 Good job BreShiE, I think I'm going to use this next time I'll download something and I don't trust it. RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - BreShiE - 03-02-2013 Version 2 is out. This gives you more check sums and the exact file size in bytes, for a deeper look into the legitimacy of the scan. RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - cxS - 03-03-2013 (03-02-2013, 06:42 PM)BreShiE Wrote: Version 2 is out. This gives you more check sums and the exact file size in bytes, for a deeper look into the legitimacy of the scan. Keep in mind filesize is essentially part of a hashing algorithm. (03-02-2013, 02:29 AM)The Anarchist Wrote: Not sure if it's clean, but checking the MD5 hash is always a good idea when downloading stuff. It's a start to a good idea. MD5 collisions are more commonly matched now so it is not a guarantee that the integrity of the file is still up to par... You should be comparing with SHA1 minimum in my opinion, or something a bit more aggressive like SHA256. Code: Private Function GetFileSize(ByVal MyFilePath As String) As Long
Dim num As Long
Dim info As New FileInfo(MyFilePath)
Dim str As String = Conversions.ToString(info.Length)
Me.TextBox5.Text = (str & " (in bytes)")
Return num
End FunctionDo you actually has a function that returns 0 all the time and acts as a Sub for the most part? You should also just call the ToString() method instead of converting to a string that way in my opinion. Code: Private Function ByteArrayToString(ByVal arrInput As Byte()) As String
Dim builder As New StringBuilder((arrInput.Length * 2))
Dim num2 As Integer = (arrInput.Length - 1)
Dim i As Integer = 0
Do While (i <= num2)
builder.Append(arrInput(i).ToString("X2"))
i += 1
Loop
Return builder.ToString.ToLower
End FunctionNo for loop here? Code: Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Clipboard.Clear
Clipboard.SetText(Me.TextBox2.Text)
Interaction.MsgBox("Hash copied!", MsgBoxStyle.Information, Nothing)
End Sub
Private Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs)
Clipboard.Clear
Clipboard.SetText(Me.TextBox3.Text)
Interaction.MsgBox("Hash copied!", MsgBoxStyle.Information, Nothing)
End Sub
Private Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs)
Clipboard.Clear
Clipboard.SetText(Me.TextBox4.Text)
Interaction.MsgBox("Hash copied!", MsgBoxStyle.Information, Nothing)
End SubWhen you call SetText(), it clears out all pre-existing data anyways, so no need to call Clear() here. Why are you using MsgBox() though? Aside from it's use, Nothing is the default argument value anwyays for the overload that you are calling here, so really you only needed this: MsgBox("Hash copied!", MsgBoxStyle.Information) Code: Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.OpenFileDialog1.ShowDialog
Me.TextBox1.Text = Me.OpenFileDialog1.FileName
Me.MD5CalcFile(Me.OpenFileDialog1.FileName)
Me.GetFileSize(Me.OpenFileDialog1.FileName)
Me.Button2.Enabled = True
Me.Button3.Enabled = True
Me.Button4.Enabled = True
End SubWhat if they press cancel button. No error handling here?? Not to mention... You've got both MD5CalcFile() and GetFileSize() declared as functions, but they aren't used like a function as you're not doing anything with the return values. What you did for the return values was completely unnecessary. Code: Public Function MD5CalcFile(ByVal filepath As String) As String
Using stream As FileStream = New FileStream(filepath, FileMode.Open, FileAccess.Read)
Using provider As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Using provider2 As SHA1CryptoServiceProvider = New SHA1CryptoServiceProvider
Using provider3 As SHA256CryptoServiceProvider = New SHA256CryptoServiceProvider
Dim str As String
Dim arrInput As Byte() = provider.ComputeHash(stream)
Dim buffer2 As Byte() = provider2.ComputeHash(stream)
Dim buffer3 As Byte() = provider3.ComputeHash(stream)
Me.TextBox2.Text = Me.ByteArrayToString(arrInput)
Me.TextBox3.Text = Me.ByteArrayToString(buffer2)
Me.TextBox4.Text = Me.ByteArrayToString(buffer3)
Return str
End Using
End Using
End Using
End Using
End FunctionFunction: - Dim str As String - Return String ??? This is a horrible use of the Using statement as well. They should never be intertwined like that because they are in no way related to one another. So even if you are done with one object, it's Dispose() method will never be called until everything is done with, and that is poor design. RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - BreShiE - 03-03-2013 Since when does it have to be good code? It works, doesn't it? You're treating this like I'm coding it for a business/customer. I coded this just for practical use by those who don't trust the validity of a virus scan, so who cares what the code is like? RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - Kinanizer - 03-03-2013 (03-03-2013, 03:28 PM)BreShiE Wrote: Since when does it have to be good code? It works, doesn't it? You're treating this like I'm coding it for a business/customer. I coded this just for practical use by those who don't trust the validity of a virus scan, so who cares what the code is like? Breshie, I believe he is only trying to help. Just take it as a suggestion, don't start a fight. Also, thanks for the program. RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - Balls - 03-03-2013 Thanks for this. I really needed it. RE: File Hash Checker - Verify Virus Scans - MD5/SHA1/SHA256 - cxS - 03-03-2013 (03-03-2013, 03:28 PM)BreShiE Wrote: Since when does it have to be good code? It works, doesn't it? You're treating this like I'm coding it for a business/customer. I coded this just for practical use by those who don't trust the validity of a virus scan, so who cares what the code is like? Since when? :huh: Always..? Skids go for code that "just works", but isn't great code. Real programmers, are more diligent at avoiding that. "Sinde when does it have to be good code?".. ... Why release something if it isn't? Do you have any idea of the benefit "good" code has over "bad" code, not only just to avoid discussions like this between other members, but in terms of the program at runtime?Quote:You're treating this like I'm coding it for a business/customer You're releasing it aren't you? So what are you trying to say here? Quote:I coded this just for practical use by those who don't trust the validity of a virus scan, so who cares what the code is like? Perhaps lots more than just myself? Why would I run a shitty program on my computer if I know there are issues with a program? Why should I trust it enough to run the program? Larger programs out there, with developers like you here, have been known for programs that corrupt a persons PC and cause blue screens with everything from registry errors to partition table damage. Are you really going to debate why you shouldn't write good code for a program YOU are releasing to the members here or are you going to put on your big boy pants and take my advice for what it is? In other words... Do you want to stay a shitty programmer or do you want to improve? Because if you don't... Then I don't know what you're doing here if you can't take very valid feedback. Read what Kinanizer had said to you. Don't complain if you receive feedback you don't like because I posted that for a good few reasons. :blackhat: |