„LnxUser::setDefaultPasswordHash” változatai közötti eltérés
Innen: IT documentation
| 1. sor: | 1. sor: | ||
== Description == | == Description == | ||
Object-oriented style<syntaxhighlight lang="php"> | Object-oriented style<syntaxhighlight lang="php"> | ||
public lnxUser::setDefaultPasswordHash( string $hash ): bool | public lnxUser::setDefaultPasswordHash( string $hash, string $salt = '', $round = '' ): bool | ||
</syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | </syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | ||
public lnxSetDefaultPasswordHash( string $hash ): bool | public lnxSetDefaultPasswordHash( string $hash, string $salt = '', $round = '' ): bool | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Set the default password hash method. | Set the default password hash method. | ||
MD5, SHA-256, SHA-512 password hash methods are implemented. | DES, Extended DES, MD5, BLOWFISH, SHA-256, SHA-512 password hash methods are implemented. | ||
== Parameters == | == Parameters == | ||
; hash | ; hash | ||
: Hash algorithm type. Use [[LnxUser PHP Class Reference|LNX_PH family of constants]]. | : Hash algorithm type. Use [[LnxUser PHP Class Reference|LNX_PH family of constants]]. | ||
salt | |||
Default password hash salt | |||
round | |||
Default password hash round | |||
You can read about password hash, salt, round relationships and requirements [https://www.php.net/manual/en/function.crypt here]. | |||
== Return Values == | == Return Values == | ||
| 21. sor: | 30. sor: | ||
!Version<br>(lnxUser) | !Version<br>(lnxUser) | ||
!Description | !Description | ||
|- | |||
|1.2 | |||
|add: default salt and round | |||
|- | |- | ||
|1.1 | |1.1 | ||
A lap 2021. szeptember 23., 19:08-kori változata
Description
Object-oriented style
public lnxUser::setDefaultPasswordHash( string $hash, string $salt = '', $round = '' ): bool
Procedural style
public lnxSetDefaultPasswordHash( string $hash, string $salt = '', $round = '' ): bool
Set the default password hash method.
DES, Extended DES, MD5, BLOWFISH, SHA-256, SHA-512 password hash methods are implemented.
Parameters
- hash
- Hash algorithm type. Use LNX_PH family of constants.
salt
Default password hash salt
round
Default password hash round
You can read about password hash, salt, round relationships and requirements here.
Return Values
Returns true if setting is success, false otherwise.
Changelog
| Version (lnxUser) |
Description |
|---|---|
| 1.2 | add: default salt and round |
| 1.1 | available |
Examples
$user = 'testUser';
lnxAddUser( [
'name' => $user,
'password' => 'HelloNSA',
] );
$array = lnxGetUser ( $user );
print( $array['password'] . PHP_EOL );
lnxSetDefaultPasswordHash( LNX_PH_MD5 );
lnxModifyUser ( [
'name' => $user,
'password' => 'HelloAgainNSA',
] );
$array = lnxGetUser ( $user );
print( $array['password'] . PHP_EOL );