LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello,

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:
<?php
$passwordplain
="AVGdcE512i";
echo 
"password = ".$passwordplain ."<br>";
echo 
"userPassword: {SSHA}8N8CiiVmAxaVQ6pY/Q78zC5igYY4NRiu"."<br>";
echo 
"<br>";


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

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

Last edited by jonaskellens; 02-25-2013 at 08:33 AM.
 
Old 10-08-2014, 12:49 AM   #2
bvbsandeep
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))); 
 
  


Reply


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 08:53 AM
ldap userPassword to /etc/shadow hash chakkerz Linux - Server 2 09-27-2011 03:11 AM
Need a user friendly tool for users to change ldap userpassword Niceman2005 Linux - Software 3 08-27-2007 09:54 PM
perl + ldap + userPassword hash ANU Programming 1 10-26-2006 11:49 AM
LDAP Authentication(UserPassword validation) joeyBig Linux - General 4 09-21-2004 06:50 PM


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

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