„LnxUser::getPassHash” változatai közötti eltérés

Innen: IT documentation
Nincs szerkesztési összefoglaló
 
(9 közbenső módosítás ugyanattól a szerkesztőtől nincs mutatva)
1. sor: 1. sor:
== Description ==
== Description ==
Object-oriented style<syntaxhighlight lang="php">
Object-oriented style<syntaxhighlight lang="php">
 
public lnxUser::getPassHash ( string $password, string $hash = '', string $salt = '', string|int $round = '' ): string
</syntaxhighlight>Procedural style<syntaxhighlight lang="php">
</syntaxhighlight>Procedural style<syntaxhighlight lang="php">
lnxGetPassHash ( string $password, string $hash = '', string $salt = '', string|int $round = '' ): string
</syntaxhighlight>


</syntaxhighlight>
Creates a password hash.


DES, MD5, BLOWFISH, SHA-256, SHA-512 password hash methods are implemented.


== Parameters ==
== Parameters ==


; password
: Password string.
; hash
: Password hash algorithm type. Use [[LnxUser PHP Class Reference#Constants|LNX_PH family of constants]].
: If empty will be used the default hash method.
; salt
: Password hash salt. Must be alphanumeric.
: If empty salt will be generated.
; round
: Password hash rounds. Must be alphanumeric or integer.
: If empty salt will be generated.
You can read about password hash, salt, round relationships and requirements [https://www.php.net/manual/en/function.crypt here].


== Return Values ==
== Return Values ==


 
Returns a '''hashed password''' or '''empty''' if an error occurred.
== Changelog ==
== Changelog ==
{| class="wikitable"
{| class="wikitable"
!Version<br>(lnxUser)
!Version<br>(lnxUser)
!Description
!Description
|-
|1.2
|add: round hadle
|-
|1.1
|remove: mkpassword dependency<br>add: default hash handle
|-
|-
|1.00
|1.00
24. sor: 46. sor:
== Examples ==
== Examples ==
<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
$user = 'testUser';
$hash = lnxGetPassHash ( 'HelloNSA' );
$group = 'testGroup';
 
print( "Password hash is $hash." . PHP_EOL );


</syntaxhighlight>
</syntaxhighlight>
[[Kategória:LnxUser]]
[[Kategória:LnxUser]]

A lap jelenlegi, 2021. szeptember 24., 11:24-kori változata

Description

Object-oriented style

public lnxUser::getPassHash ( string $password, string $hash = '', string $salt = '', string|int $round = '' ): string

Procedural style

lnxGetPassHash ( string $password, string $hash = '', string $salt = '', string|int $round = '' ): string

Creates a password hash.

DES, MD5, BLOWFISH, SHA-256, SHA-512 password hash methods are implemented.

Parameters

password
Password string.
hash
Password hash algorithm type. Use LNX_PH family of constants.
If empty will be used the default hash method.
salt
Password hash salt. Must be alphanumeric.
If empty salt will be generated.
round
Password hash rounds. Must be alphanumeric or integer.
If empty salt will be generated.

You can read about password hash, salt, round relationships and requirements here.

Return Values

Returns a hashed password or empty if an error occurred.

Changelog

Version
(lnxUser)
Description
1.2 add: round hadle
1.1 remove: mkpassword dependency
add: default hash handle
1.00 available

Examples

$hash = lnxGetPassHash ( 'HelloNSA' );

print( "Password hash is $hash." . PHP_EOL );