JLDAP/generatePassword
From Joomla! Documentation
< API16:JLDAP
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Generates a LDAP compatible password
<! removed transcluded page call, red link never existed >
Syntax[edit]
generatePassword($password, $type='md5')
Parameter Name | Default Value | Description |
---|---|---|
$password | password Clear text password to encrypt | |
$type | 'md5' | type Type of password hash, either md5 or SHA |
Returns[edit]
string encrypted password
Defined in[edit]
libraries/joomla/client/ldap.php
Importing[edit]
jimport( 'joomla.client.ldap' );
Source Body[edit]
function generatePassword($password, $type='md5') {
$userpassword = '';
switch(strtolower($type)) {
case 'sha':
$userpassword = '{SHA}' . base64_encode(pack('H*', sha1($password)));
case 'md5':
default:
$userpassword = '{MD5}' . base64_encode(pack('H*', md5($password)));
break;
}
return $userpassword;
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]