php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11240 Crypt works only with the first 8 chars
Submitted: 2001-06-01 10:21 UTC Modified: 2001-06-01 11:44 UTC
From: greg at jalix dot org Assigned:
Status: Closed Package: *Encryption and hash functions
PHP Version: 4.0.5 OS: Linux 2.2.19
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
30 + 47 = ?
Subscribe to this entry?

 
 [2001-06-01 10:21 UTC] greg at jalix dot org
The crypt function only crypt the first 8 chars of the string.
I have tested it only with the Standard DES encryption with a 2-char salt.

For example :
  crypt('mypasswd', 'Xz')
  crypt('mypasswdblah', 'Xz')
will produce the same string

This is not specified in the doc, and this is not the normal behaviour
of the Linux crypt function...
But unfortunately, if you correct this, some old crypted string will
not match with the new (and correct) encryption.

So, do you know this bug, and what are you planing ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-01 11:44 UTC] sniper@php.net
This is exactly the normal behaviour of Linux crypt()
if you pass it a 2 char salt.

Try with MD5. That will work on longer strings than 8 chars.

--Jani

crypt/DES is 56 (7 ASCII bits * 8) bits based..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC