04-18-2011, 11:11 AM
Mines not very good lol... The code is a disgrace but who cares...
Here it is:
Screenshot:
Download Link:
http://www.mediafire.com/?l7fcwllktky1wmc
Source Code:
Here it is:
Spoiler (Click to View)
Screenshot:
Download Link:
http://www.mediafire.com/?l7fcwllktky1wmc
Source Code:
Code:
Imports System.Security.Cryptography
Imports System.IO
Imports System.Text
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Gets raw MD5 hash of file
Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim lol As FileStream = New FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md5.ComputeHash(lol)
lol.Close()
Dim md52 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim lol2 As FileStream = New FileStream(TextBox2.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md52.ComputeHash(lol2)
lol2.Close()
'Appends & formats the hash
Dim hsh As Byte() = md5.Hash
Dim buf As StringBuilder = New StringBuilder
Dim hshByt As Byte
For Each hshByt In hsh
buf.Append(String.Format("{0:X2}", hshByt))
Next
Dim hsh2 As Byte() = md52.Hash
Dim buf2 As StringBuilder = New StringBuilder
Dim hshByt2 As Byte
For Each hshByt2 In hsh2
buf2.Append(String.Format("{0:X2}", hshByt2))
Next
'Displays final MD5 Checksum
TextBox3.Text = buf.ToString()
TextBox4.Text = buf2.ToString()
'Displays comparison status
If TextBox3.Text = TextBox4.Text Then
Label4.ForeColor = Color.Red
Label4.Text = "Files Are Identical"
Else
Label4.ForeColor = Color.Green
Label4.Text = "Files Are Unidentical"
End If
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim ofd As OpenFileDialog = New OpenFileDialog()
ofd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
ofd.RestoreDirectory = True
ofd.InitialDirectory = "C:\"
ofd.FilterIndex = 2
If ofd.ShowDialog = DialogResult.OK Then
TextBox2.Text = ofd.FileName.ToString()
End If
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Try
'Gets raw MD5 hash of file
Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim lol As FileStream = New FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md5.ComputeHash(lol)
lol.Close()
Dim md52 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim lol2 As FileStream = New FileStream(TextBox2.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md52.ComputeHash(lol2)
lol2.Close()
'Appends & formats the hash
Dim hsh As Byte() = md5.Hash
Dim buf As StringBuilder = New StringBuilder
Dim hshByt As Byte
For Each hshByt In hsh
buf.Append(String.Format("{0:X2}", hshByt))
Next
Dim hsh2 As Byte() = md52.Hash
Dim buf2 As StringBuilder = New StringBuilder
Dim hshByt2 As Byte
For Each hshByt2 In hsh2
buf2.Append(String.Format("{0:X2}", hshByt2))
Next
'Displays final MD5 Checksum
TextBox3.Text = buf.ToString()
TextBox4.Text = buf2.ToString()
'Displays comparison status
If TextBox3.Text = TextBox4.Text Then
Label4.ForeColor = Color.OrangeRed
Label4.Text = "Files Are Identical"
Else
Label4.ForeColor = Color.LightGreen
Label4.Text = "Files Are Unidentical"
End If
Catch Ex As Exception
MessageBox.Show("Please select 2 files to compare")
End Try
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
'Allows user to choose file
Dim ofd As OpenFileDialog = New OpenFileDialog()
ofd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
ofd.RestoreDirectory = True
ofd.InitialDirectory = "C:\"
ofd.FilterIndex = 2
If ofd.ShowDialog = DialogResult.OK Then
TextBox1.Text = ofd.FileName.ToString()
End If
End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
Dim ofd As OpenFileDialog = New OpenFileDialog()
ofd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
ofd.RestoreDirectory = True
ofd.InitialDirectory = "C:\"
ofd.FilterIndex = 2
If ofd.ShowDialog = DialogResult.OK Then
TextBox2.Text = ofd.FileName.ToString()
End If
End Sub
End Class