Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi-ITNOG

is there any faster way to find two file is similar instead of using hash code .

using hash code for large files is really slow .

regards
Posted
Comments
Toli Cuturicu 20-Jul-10 10:49am    
Reason for my vote of 1
post at the article, not here!

Apart from what CG has told,
It looks like you want to ask this question to an author related to his/her article.

I would suggest you to please use the forum present at the end of the article in order to reach author and get quick response. Rarely you will find authors reading this forum.

Please post the same at the article's message forum.
 
Share this answer
 
Comments
Christian Graus 19-Jul-10 3:47am    
I wondered that but thought ITNOG is more likely to stand for something than be someone :-)
Sauro Viti 19-Jul-10 9:31am    
I had searched a bit... It seems that ITNOG stands for "In The Name Of Glory" or "In The Name Of God" :-)
Sandeep Mewara 19-Jul-10 9:56am    
Ah! might be... it fits in. :)
Fullmm 19-Jul-10 14:22pm    
I used -In The Name Of God- wish every one use this in his post . so we may find ourself and do not start any war ! any lie , any ...
You can make a decision that if xx bytes are the same, they are the same file. Hash codes won't tell you if they are similar, only the same, or different.
 
Share this answer
 
Comments
Fullmm 19-Jul-10 14:24pm    
Ho can I do this ?

Getting only one some byte for compare .
You could read both files into memory, convert the string into lower case, and compare the two strings. A large file is still going to take more time than a small one, though, because the bottleneck is the hardware.
 
Share this answer
 
v3
Hi

You can do file comparision by doing byte-by-byte comparison on both the files until it finds a mismatch or it reaches the end of the file. Irrespective of the file names , below is code to compare the files
      <br />
         do<br />
            {<br />
                /* Read the bytes from each file until no match found or end of file is reached */<br />
                <br />
f1byte = f1.ReadByte();<br />
                            f2byte = f2.ReadByte();<br />
            }<br />
            while ((f1byte == f2byte) && (f1byte != -1));<br />
 
Share this answer
 
read some random bytes
is that clear?
how about LINQ?
 
Share this answer
 
Comments
Sandeep Mewara 19-Jul-10 15:49pm    
Reason for my vote of 1
It was supposed to be an answer that too a little descriptive one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900