RE: [PHP] Crypt

From: Date: Fri, 27 Oct 2000 16:21:51 +0000
Subject: RE: [PHP] Crypt
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22343@lists.php.net to get a copy of this message
> -----Original Message----- > From: jblythe@bold.binarylogic.com.au > [mailto:jblythe@bold.binarylogic.com.au]On Behalf Of Joseph H Blythe > Sent: Thursday, October 26, 2000 5:26 PM > To: Hardy Merrill > Cc: PHP-General > Subject: Re: [PHP] Crypt > > > > > $salt = substr($pwd, 0, 1); > > > > I think you want 2 as the 3rd parameter to substr - you want > > to pull out the 1st *2* characters from the currently encrypted > > password to use as the salt for the unencrypted one. > > Sorry It is a typo, it should be 2, netherless I still get > different results evertime I crypt the same password using > the first 2 chars of the encrypted one from the database as > the salt. I really don't have any idea what is going on > anyone? Depending on your system libraries (and, in particular, the type of encryption used), the correct salt length may be something other than 2. (FreeBSD systems, for example, use a crypt() implementation that has a 12-character salt.) PHP make the correct salt length for your crypt() calls available in a constant named CRYPT_SALT_LENGTH. (This, and lots of other useful information, is in the PHP manual at http://www.php.net/manual/function.crypt.php) --- Mark Roedel | "Blessed is he who has learned to laugh Systems Programmer | at himself, for he shall never cease LeTourneau University | to be entertained." Longview, Texas, USA | -- John Powell

« previous php.general (#22343) next »