Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-25-2013, 07:32 AM   #1
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
LDAP & PhP : generate SSHA userPassword


I have created an object (inetOrgPerson) with phpldapadmin with a plain password : AVGdcE512i

When I export in ldif format, I get the following encrypted userPassword : {SSHA}8N8CiiVmAxaVQ6pY/Q78zC5igYY4NRiu

I am trying to get the same encrypted value of the plain password AVGdcE512i, but I do not succeed.

I have the following php-code :

PHP Code:
"password = ".$passwordplain ."<br>";
"userPassword: {SSHA}8N8CiiVmAxaVQ6pY/Q78zC5igYY4NRiu"."<br>";

// Generate SSHA hash
$salt substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4);
$encrypted_password '{SSHA}' base64_encode(sha1$passwordplain.$saltTRUE ). $salt);
"encrypted = ".$encrypted_password ."<br>";

I get output :
encrypted = {SSHA}TjAx/sjKg9qxeAznkVOezUR0mJFaa1FN

Last edited by jonaskellens; 02-25-2013 at 07:33 AM.
Old 10-07-2014, 11:49 PM   #2
LQ Newbie
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
Not sure if this resolves, but worth trying -
after hashing pack the data into binary using pack() function -

PHP Code:
'{SSHA}' base64_encode(pack('H*',sha1($passwordplain))); 


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any ways to change the LDAP userPassword attribute into some other? arunplanet Linux - Newbie 2 10-19-2012 07:53 AM
ldap userPassword to /etc/shadow hash chakkerz Linux - Server 2 09-27-2011 02:11 AM
Need a user friendly tool for users to change ldap userpassword Niceman2005 Linux - Software 3 08-27-2007 08:54 PM
perl + ldap + userPassword hash ANU Programming 1 10-26-2006 10:49 AM
LDAP Authentication(UserPassword validation) joeyBig Linux - General 4 09-21-2004 05:50 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration