Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Automatically distributing and finding files in subdirectories

by graff (Chancellor)
on Jul 19, 2006 at 02:02 UTC ( #562172=note: print w/replies, xml ) Need Help??


in reply to Re: Automatically distributing and finding files in subdirectories
in thread Automatically distributing and finding files in subdirectories

If I understand your process correctly, wouldn't there be at least the slightest little worry that two different (original) file names would generate the same MD5 hash?

I suppose that if you just make a list of the file names and their md5 sigs first, you could spot collisions before actually moving stuff into the new directory structure. But if you have to add files to the structure over time, you need to check for the existence of a given md5 "path/name" before storing a new file there (and then figure out a proper way to avoid collisions while maintaining correct mappings between original and hashed names).

  • Comment on Re^2: Automatically distributing and finding files in subdirectories

Replies are listed 'Best First'.
Re^3: Automatically distributing and finding files in subdirectories
by Fletch (Bishop) on Jul 19, 2006 at 02:54 UTC

    Correct. If that 1 in 2128 possibility bothers you there's always Digest::SHA1 for 1 in 2160. Or keep a DBM mapping of "path" to hash and check for collisions when adding a new "path" entry.

    Update: Left out the chance of collision for SHA1.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://562172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2023-10-04 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?