Difference between revisions of "JLDAP/generatePassword"
From Joomla! Documentation
< API16:JLDAP
(New page: ===Description===
Generates a LDAP compatible password
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowik...) |
m (preparing for archive only) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Generates a LDAP compatible password | Generates a LDAP compatible password | ||
− | |||
− | |||
− | |||
− | + | ||
+ | <! removed transcluded page call, red link never existed > | ||
===Syntax=== | ===Syntax=== | ||
Line 50: | Line 48: | ||
</source> | </source> | ||
− | + | ||
− | + | <! removed transcluded page call, red link never existed > | |
− | < | ||
− | |||
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=generatePassword | category=generatePassword | ||
category=JLDAP | category=JLDAP | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Latest revision as of 20:51, 24 March 2017
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]