473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Find identical files

Hello,

I have a rather large number of files and I would like to check for
duplicates. Name or date are not relevant.

I found the MD5 class which seems to be suitable. Can I use the returned
byte[] as an index in a hashtable in order to create a mapping from
key and identical files (i.e. their names)?

Lars
Nov 15 '05 #1
4 1477
The byte[] probably cannot be used as in index in this case because each
byte[] will be a different memory object so you would not be able determine
differences. Try converting the bytes into a string (maybe base64 encode)
and use that as your index.

"Lars von Wedel" <vo******@lfpt.rwth-aachen.de> wrote in message
news:Xn**********************************@137.226. 144.7...
Hello,

I have a rather large number of files and I would like to check for
duplicates. Name or date are not relevant.

I found the MD5 class which seems to be suitable. Can I use the returned
byte[] as an index in a hashtable in order to create a mapping from
key and identical files (i.e. their names)?

Lars

Nov 15 '05 #2
Lars von Wedel <vo******@lfpt.rwth-aachen.de> wrote in
news:Xn**********************************@137.226. 144.7:
I have a rather large number of files and I would like to check for
duplicates. Name or date are not relevant.

I found the MD5 class which seems to be suitable. Can I use the returned
byte[] as an index in a hashtable in order to create a mapping from
key and identical files (i.e. their names)?


Depending on your data, CRC32 might be enough and can be held in an integer.
CRC32 rarely returns dups. On any suspected ones you run a secondary check
using MD5, or raw compare.

The advantage is that it returns integers, easier to index, faster, etc..
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 15 '05 #3
Hi,
I found the MD5 class which seems to be suitable. Can I use the
returned byte[] as an index in a hashtable in order to create a
mapping from key and identical files (i.e. their names)?


Depending on your data, CRC32 might be enough and can be held in an
integer. CRC32 rarely returns dups. On any suspected ones you run a
secondary check using MD5, or raw compare.

Good point. However, I'm already finished using MD5 which works fine
in combination with a hashtable... From a runtime or memory point of
view there is no reason to go for a more light-weight approach.

So, in case anyone's interested in a snippet...

Lars
Nov 15 '05 #4
I'd like to have a look at a snippet.. that sounds interesting.

gwmorris [AT] hotpop [DOT] com

if it's not too much trouble!

"Lars von Wedel" <vo******@lfpt.rwth-aachen.de> wrote in message
news:Xn*********************************@137.226.1 44.7...
Hi,
I found the MD5 class which seems to be suitable. Can I use the
returned byte[] as an index in a hashtable in order to create a
mapping from key and identical files (i.e. their names)?


Depending on your data, CRC32 might be enough and can be held in an
integer. CRC32 rarely returns dups. On any suspected ones you run a
secondary check using MD5, or raw compare.

Good point. However, I'm already finished using MD5 which works fine
in combination with a hashtable... From a runtime or memory point of
view there is no reason to go for a more light-weight approach.

So, in case anyone's interested in a snippet...

Lars

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raseliarison nirinA | last post by:
hi all, i found an unanswered question at http://www.faqts.com/knowledge_base/index.phtml/fid/538 with possible response below. i've tried to send it at faqt.python but can't figure out how to...
10
by: Andrei Ivanov | last post by:
Hello, it seems my postgresql data has somehow become corrupted (by a forced shutdown I think): psql template1 -U shadow Password: ERROR: nodeRead: did not find '}' at end of plan node...
4
by: Robert W. | last post by:
I've scanned through the various methods of the 'File' library but can't see any method that would be equivalent to the DOS "COMP" command. Is there, in fact, a simple method to do this or do I...
4
by: ElGordo | last post by:
Gurus: I have been working on a .Net project called "SolutionA" which was given to me (already completed) for some time. The solution had some baseline web functionality, and I was asked to...
48
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a...
1
by: Paul Wagstaff | last post by:
Hi Folks, I have a report for which I need three copies - identical in every way except each contains a label (lets call it 'lblReportInstance') with a caption saying "Part 1", "Part 2" and...
3
by: Fir5tSight | last post by:
Hi All, I have two identical PDF files, say file1 and file2. I used an API package to extract the bitmap in each PDF file, say bitmap1 (in file1) and bitmap2 (in file2). Since the bitmaps are...
6
by: Richard | last post by:
1. Are there any problems with having, for instance, POSIX's "open" function #defined more than once. In my case, these would be in different static libraries: #ifdef __cplusplus extern "C" {...
11
by: AAaron123 | last post by:
I have an vs2008 app that generates a website. I have a vs2008 app that uses the webbrowser and does this: WebBrowser1.Navigate(New Uri(address)) the address is: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.