php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: edcross at gmail dot com
New email:
PHP Version: OS:

 

 [2006-08-30 01:13 UTC] edcross at gmail dot com
Description:
------------
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 


Patches

Pull Requests

History

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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 16:01:30 2025 UTC