Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: MD5-based Unique Session ID Generator

by ctilmes (Priest)
on Aug 19, 2004 at 20:01 UTC ( #384431=note: print w/ replies, xml ) Need Help??


in reply to Re^3: MD5-based Unique Session ID Generator
in thread MD5-based Unique Session ID Generator

Double hashing without adding something else to it gains you nothing. If you get a collision with the first hash, you'll always get a collision with the second as well.

double hash just costs you processing time.


Comment on Re^4: MD5-based Unique Session ID Generator
Re^5: MD5-based Unique Session ID Generator
by ctilmes (Priest) on Aug 20, 2004 at 12:12 UTC
    I would even go as far as to say that double hashing can actually make more collisions. If you get a collision with the first hash, you absolutely will get a collision with the second hash, but if you don't get a collision with the first hash, you still have a chance of getting a collision with the second hash.

    say you start with X and Y.

    hash(X) = X'
    hash(Y) = Y'

    hash(X') = X''
    hash(Y') = Y''

    if X' = Y' (collision with first hash), then X'' = Y'' (collision with second hash)
    if X' != Y' (no collision with first hash), then X'' may = Y'' (possible collision with second hash)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2015-07-07 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls