View Single Post
  #8 (permalink)  
Old May 8th, 2003
tshdos tshdos is offline
Gnutella Veteran
 
Join Date: March 24th, 2002
Location: Virginia
Posts: 101
tshdos is flying high
Default

Quote:
Originally posted by der_schreckliche_sven
not necessarily a good idea. It's possible that two files will have the same hash. And in that case your program would not work correctly whenever the rare case occurs that the hash function returns the same hash for two files.

If it's just for the purpose of storing it in a table, I would not use a hash function at all. I would just use a simple incrementing index for each file.
True, I have yet to see it happen, but I am sure with only a 32 bit hash you will at some point have collisions.

As for speed, you really wouldn't see much of a difference either way, but incremental index does seem easier.
Reply With Quote