Re: [PHP4BETA] CVS update: php4/ext/session

From: Date: Tue, 08 Jun 1999 12:16:25 +0000
Subject: Re: [PHP4BETA] CVS update: php4/ext/session
References: 1 2 3 4 5 6  Groups: php.version4 
Request: Send a blank email to php-version4+get-1393@lists.php.net to get a copy of this message
Sascha Schumann wrote: > > An md5() hash may have collisions, but the probability > > for such collisions is so incredibly low that we do not > > need to care about that. It is an evenly distributed > > 2^128 bit value. With a million simultaneously active > > sessions (2^20 sessions), this leaves you with a > > collision probability of 2^-108. This is zero for all > > practical purposes. > > Where did you get the numbers from? Please quote your source. This is simple mathmatics. If MD5 were an ideal cryptographic hash function (which it isn't), there would be no backward correlation, i.e. you cannot successfully determine the input values of the function from the hash result. This implies an even distribution of hash results. The output domain of MD5 is the integer interval 0 to 2^128-1. Assuming that MD5 is a perfect hash (and therefore has an even distribution), you are allowed to simply divide to determine the probabilities. 2^20 / 2^128 (assuming one million session ids currently in use) gives you a collision probability of 1/2^108 or 2^-108. That is treating MD5 as a valid implementation of a cryptographic hash function. If you aren't satisfied with MD5, substitute any other hash that you like better and has a sufficiently large result domain. I think that MD5 is sufficient for the purpose at hand, i.e. making session ids hard to guess. > So, we might as well drop MD5 as hash function and use SHA > instead. The only cause for the current choice is that PHP > always includes MD5. Correct. Does anybody know which hash- and digest functions can be included into PHP without making it unexportable? I would like to load as much crypto functionality into the PHP distribution as is legally possible (and provide the rest from somewhere in the free world as a simple module). Kristian -- Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00 Using PHP3? See our web development library at http://phplib.shonline.de/ (GPL)

« previous php.version4 (#1393) next »