Forum und email

Crack Functions

소개

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.

Note: This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 5.0.0.

요구 조건

More information regarding CrackLib along with the library can be found at » https://sourceforge.net/projects/cracklib.

설치

» PECL 확장은 PHP 배포판에서 제공하지 않습니다. PECL 확장 설치에 관한 정보는 매뉴얼의 PECL 확장 설치에 있습니다. 새 릴리즈, 내려받기, 소스파일, 개발자 정보, CHANGELOG 등의 추가 정보는 여기에 있습니다: » https://pecl.php.net/package/crack.

PHP 4에서 이 PECL 확장의 소스는 PHP 소스의 ext/ 디렉토리 안이나, 위의 PECL 링크에서 찾을 수 있습니다. 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. PHP 4에서 이 DLL 형식은 내려받은 PHP 윈도우 바이너리 안의 extensions/ 디렉토리 안에 있습니다. PECL 확장 DLL» PHP 내려받기 페이지나 » https://pecl4win.php.net/에서 받을 수 있습니다.

실행시 설정

이 함수의 작동은 php.ini 설정에 영향을 받습니다.

Crack configuration options
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.
PHP_INI_* 상수에 대한 자세한 상세와 정의는 php.ini directives를 참고하십시오.

자원형

The CrackLib extension defines a dictionary resource identifier returned by crack_opendict().

예약 상수

이 확장은 상수를 정의하지 않습니다.

예제

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);
?>

Note: If crack_check() returns TRUE, crack_getlastmessage() will return 'strong password'.

Table of Contents