|
-
Feb 13th, 2003, 02:57 PM
#1
Thread Starter
Sleep mode
comparing files??[Resolved]
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
Last edited by Pirate; Feb 14th, 2003 at 03:56 PM.
-
Feb 13th, 2003, 03:27 PM
#2
Frenzied Member
maybe comparing the md5 digest will be a good way
-
Feb 13th, 2003, 03:30 PM
#3
Thread Starter
Sleep mode
I would never code this!! .all what I need is a tool ??
-
Feb 13th, 2003, 03:33 PM
#4
Thread Starter
Sleep mode
Originally posted by Lunatic3
maybe comparing the md5 digest will be a good way
What are you talking about here ?
-
Feb 13th, 2003, 03:41 PM
#5
Frenzied Member
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.
-
Feb 13th, 2003, 03:44 PM
#6
Thread Starter
Sleep mode
sounds easy but how can I start with this ?any idea or example .
thanx
-
Feb 13th, 2003, 03:55 PM
#7
Frenzied Member
I just know the concept and never tried the cryptography classes of .NET. I will give it a try.
-
Feb 13th, 2003, 05:45 PM
#8
Thread Starter
Sleep mode
It's frustrating Class .I couldn't do anything .
-
Feb 13th, 2003, 06:30 PM
#9
Frenzied Member
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
-
Feb 14th, 2003, 06:19 AM
#10
Thread Starter
Sleep mode
It works but I didn't compare those protected files yet ! just txt files.
Thanx Lunatic3 .
-
Feb 14th, 2003, 11:56 AM
#11
Frenzied Member
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.
-
Feb 14th, 2003, 12:22 PM
#12
Thread Starter
Sleep mode
Good Idea ! but Can this tool compare Dlls ?(which is all the fuss over)???
-
Feb 14th, 2003, 03:44 PM
#13
Frenzied Member
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.
-
Feb 14th, 2003, 03:55 PM
#14
Thread Starter
Sleep mode
I've tested it on some dlls and passed the test.
Thanx dude!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|