Hello

'salt' basically is the initialization sequence for the encryption. This 
makes the function use more random numbers since the salt will be 
different on different calls. At least it should be....

So in order for your crypt() to work you have to pass the same salt to 
both functions. 
To determine the 'salt' take the first two letters/numbers (this is the 
defualt but better check the PHP constant CRYPT_SALT_LENGTH for the real 
length of the salt) of the crypted text and pass them as the salt to the 
second and they should come out equal...

<?PHP
        $test=crypt('test');
        print $test. "<br>";
 $test2=crypt('test', substr($test, 0, 2)); // if CRYPT_SALT_LENGTH is 
more then two just pass in that number as the 
// third parameter to substr
 print $test2. "<br>";

?> 

Have fun experimenting around
Stefan

Reply via email to