Crack Functions
Introducere
These functions allow you to use the CrackLib library to test the 'strength' of a password. The 'strength' of a password is tested by that checks length, use of upper and lower case and checked against the specified CrackLib dictionary. CrackLib will also give helpful diagnostic messages that will help 'strengthen' the password.
Notă: Această extensie a fost transferată în repozitoriul » PECL ÅŸi nu mai este furnizată împreună cu PHP începând cu versiunea 5.0.0.
Necesităţi
More information regarding CrackLib along with the library can be found at » https://sourceforge.net/projects/cracklib.
Instalarea
Această extensie » PECL nu este încorporată în PHP. InformaÅ£ie despre instalarea acestei extensii PECL poate fi găsită în capitolul manualului, întitulat Instalarea extensiilor PECL. InformaÅ£ii adiÅ£ionale, cum ar fi lansări noi, descărcări, fiÅŸiere-sursă, informaÅ£ii despre persoana care întreÅ£ine extensia ÅŸi istoria schimbărilor poate fi localizată aici: » https://pecl.php.net/package/crack.
În PHP 4 sursa acestei extensii PECL poate fi găsită în directorul ext/ din sursa PHP, sau la referinţa PECL de mai sus. In order to use these functions you must compile PHP with Crack support by using the --with-crack[=DIR] configuration option.
Windows users will enable php_crack.dll inside of php.ini in order to use these functions. ÃŽn PHP 4 acest DLL se află în directorul extensions/ al distributivului PHP pentru Windows. Biblioteca DLL pentru această extensie PECL poate fi descărcată de pe pagina » PHP Downloads sau de pe » https://pecl4win.php.net/
Configuraţia la rulare
Comportamentul acestor funcţii este afectat de parametrii stabiliţi în php.ini.
Name | Default | Changeable | Changelog |
---|---|---|---|
crack.default_dictionary | NULL | PHP_INI_PERDIR | PHP_INI_SYSTEM in crack <= 0.2. Available since PHP 4.0.5. Removed in PHP 5.0.0. |
Tipurile resurselor
The CrackLib extension defines a dictionary resource identifier returned by crack_opendict().
Constante predefinite
Această extensie nu are constante definite.
Exemple
This example shows how to open a CrackLib dictionary, test a given password, retrieve any diagnostic messages, and close the dictionary.
Example#1 CrackLib example
<?php
// Open CrackLib Dictionary
$dictionary = crack_opendict('/usr/local/lib/pw_dict')
or die('Unable to open CrackLib dictionary');
// Perform password check
$check = crack_check($dictionary, 'gx9A2s0x');
// Retrieve messages
$diag = crack_getlastmessage();
echo $diag; // 'strong password'
// Close dictionary
crack_closedict($dictionary);
?>
Notă: If crack_check() returns TRUE, crack_getlastmessage() will return 'strong password'.
Cuprins
- crack_check — Performs an obscure check with the given password
- crack_closedict — Closes an open CrackLib dictionary
- crack_getlastmessage — Returns the message from the last obscure check
- crack_opendict — Opens a new CrackLib dictionary