I need a tool that compare files (very sensitive and maybe secured files)?I know this can be difficult to code in .NET !
thanx for any help
Printable View
I need a tool that compare files (very sensitive and maybe secured files)?I know this can be difficult to code in .NET !
thanx for any help
maybe comparing the md5 digest will be a good way
I would never code this!! .all what I need is a tool ??
What are you talking about here ?Quote:
Originally posted by Lunatic3
maybe comparing the md5 digest will be a good way
Well MD5 computes the message digest of a file or string. If two files generate a same MD5 digest then it has a very high probability that they are the same.
sounds easy but how can I start with this ?any idea or example .
thanx
I just know the concept and never tried the cryptography classes of .NET. I will give it a try.
It's frustrating Class .I couldn't do anything .:(
See if this helps you
VB Code:
Dim md5test As New MD5CryptoServiceProvider() Dim enc As New System.Text.ASCIIEncoding() Dim cfile() As Byte Dim compdigest As String Dim FS As New FileStream("C:\test1.txt", FileMode.Open) Dim sr As StreamReader = New StreamReader(FS) cfile = enc.GetBytes(sr.ReadToEnd) compdigest = enc.GetString(md5test.ComputeHash(cfile)) TextBox1.Text = compdigest sr.Close() FS.Close() cfile = Nothing FS = New FileStream("C:\test2.txt", FileMode.Open) sr = New StreamReader(FS) cfile = enc.GetBytes(sr.ReadToEnd) compdigest = enc.GetString(md5test.ComputeHash(cfile)) TextBox2.Text = compdigest sr.Close() FS.Close() cfile = Nothing If TextBox1.Text = TextBox2.Text Then MessageBox.Show("Files are identical") Else MessageBox.Show("Files are different") End If
It works but I didn't compare those protected files yet ! just txt files.
Thanx Lunatic3 .
I have tested this on binary files and works fine. You dont even have to use a binaryreader to read those files. Ofcourse before going through this process you may first check for the files sizes and if they differ then they are different and if not then compare them this way.
Good Idea ! but Can this tool compare Dlls ?(which is all the fuss over)???
Even binary files like dll's when treated as text are bunch of ascii characters though not human readable. I tried ti and it works great with dlls. To test it, make two copies of one dll and try it. Then open one in a Hex editor and chnge only a byte and see the result.
I've tested it on some dlls and passed the test.
Thanx dude!