Hey everyone,

I have a CGI script which currently manages the users on my website. This Perl script uses encryption to encrypt passwords and then adds them to the database of users.

I need to change the crypt string from Perl to PHP. The code which I was given by the creator of the CGI script works, but creates a different hash than the Perl.

Here is the encryption string in Perl:

$encrypted_password = substr(crypt($password,substr($password,0,2)),2);

Any ideas how to make a PHP that hashes the same?

Thanks for any help!

tgmsocal

    // perl version
    $encrypted_password = substr(crypt($password,substr($password,0,2)),2); 
    
    // PHP version
    $encrypted_password = substr(crypt($password,substr($password,0,2)),2); 
    

    Hehe 🙂

      So then why do I get a different hash than the Perl?

      It is on the same server, so shouldn't it be using the same libcrypt module?

      Any ideas.. let me hear them please!

      --tgmsocal

        On this machine (Win32) I get the same hash using PHP 5.0.2 and TinyPerl 2.

          Write a Reply...