|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38646 crypt function problem
Submitted: 2006-08-30 01:13 UTC Modified: 2006-08-30 06:42 UTC
From: edcross at gmail dot com Assigned:
Status: Not a bug Package: *Encryption and hash functions
PHP Version: 5.1.5 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: edcross at gmail dot com
New email:
PHP Version: OS:


 [2006-08-30 01:13 UTC] edcross at gmail dot com
I am using Zendcore + PHP 5.1.4 with no extra addonds.

When using the crypt function this way everything seems correct:

echo crypt( 'password', '$1$driak4UgiErluyoe@I&glevOudr0aK' );

(Using $1$ at the begining of the salt so it gives me back a MD5 result)

The same function but this way (notice the " instead of ' around the salt):

echo crypt( 'password', "$1$driak4UgiErluyoe@I&glevOudr0aK" );

It gives me back a DES result. The only diference is how the salt is enclosed, duh!?

Reproduce code:
echo crypt( 'password', "$1$driak4UgiErluyoe@I&glevOudr0aK" );
echo crypt( 'password', '$1$driak4UgiErluyoe@I&glevOudr0aK' );      

Expected result:
result1: $1$driak4Ug$AFGh.vpAzgjk4h9wVqs2a1 
result2: $1$driak4Ug$AFGh.vpAzgjk4h9wVqs2a1

Actual result:
result1: $1Oyx5r9mdGZ2
result2: $1$driak4Ug$AFGh.vpAzgjk4h9wVqs2a1 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-30 06:42 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 26 23:01:25 2020 UTC