mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 23:38:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@68146 c90b9560-bf6c-de11-be94-00142212c4b1
192 lines
No EOL
5.6 KiB
XML
192 lines
No EOL
5.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<reference id="ref.crack">
|
|
<title>Crack functions</title>
|
|
<titleabbrev>Crack functions</titleabbrev>
|
|
|
|
<partintro>
|
|
<simpara>
|
|
These functions allow you to use the CrackLib library to test the 'strength'
|
|
of a password. In order to use these functions, you must compile PHP with
|
|
Crack support by using the <option role="configure">--with-crack[=DIR]</option>
|
|
option.
|
|
</simpara>
|
|
<simpara>
|
|
More information regarding CrackLib along with the library can be found at
|
|
<ulink url="&url.crack;">&url.crack;</ulink>.
|
|
</simpara>
|
|
<simpara>
|
|
Cracklib is useful in testing the 'strength' of a password that checks
|
|
length, use of upper and lower case and a check against the specified CrackLib
|
|
dictionary. CrackLib will also give helpful diagnostic messages that will
|
|
help 'strengthen' the password.
|
|
</simpara>
|
|
<para>
|
|
This example shows how to open a CrackLib dictionary, test a given password,
|
|
retrieve any diagnostic messages, and close the dictionary.
|
|
<example>
|
|
<title>CrackLib example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?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);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
If <function>crack_check</function> returns &true;,
|
|
<function>crack_getlastmessage</function> will return 'strong password'.
|
|
</para>
|
|
</note>
|
|
</partintro>
|
|
|
|
|
|
<refentry id="function.crack-opendict">
|
|
<refnamediv>
|
|
<refname>crack_opendict</refname>
|
|
<refpurpose>Opens a new CrackLib dictionary</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>resource <function>crack_opendict</function></funcdef>
|
|
<paramdef>string <parameter>dictionary</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns a dictionary resource identifier on success, or &false; on failure.
|
|
</para>
|
|
&warn.experimental.func;
|
|
<para>
|
|
<function>crack_opendict</function> opens the specified CrackLib
|
|
<parameter>dictionary</parameter> for use with
|
|
<function>crack_check</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Only one dictionary may be open at a time.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
See also: <function>crack_check</function>, and
|
|
<function>crack_closedict</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.crack-closedict">
|
|
<refnamediv>
|
|
<refname>crack_closedict</refname>
|
|
<refpurpose>Closes an open CrackLib dictionary </refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>bool <function>crack_closedict</function></funcdef>
|
|
<paramdef>resource
|
|
<parameter><optional>dictionary</optional></parameter>
|
|
</paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
&warn.experimental.func;
|
|
<para>
|
|
<function>crack_closedict</function> closes the specified
|
|
<parameter>dictionary</parameter> identifier. If
|
|
<parameter>dictionary</parameter> is not specified, the current
|
|
dictionary is closed.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.crack-check">
|
|
<refnamediv>
|
|
<refname>crack_check</refname>
|
|
<refpurpose>Performs an obscure check with the given password</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>bool <function>crack_check</function></funcdef>
|
|
<paramdef>resource
|
|
<parameter><optional>dictionary</optional></parameter>
|
|
</paramdef>
|
|
<paramdef>string <parameter>password</parameter></paramdef>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns &true; if <parameter>password</parameter> is strong, or &false; otherwise.
|
|
</para>
|
|
&warn.experimental.func;
|
|
<para>
|
|
<function>crack_check</function> performs an obscure check with the given
|
|
<parameter>password</parameter> on the specified <parameter>dictionary
|
|
</parameter>. If <parameter>dictionary</parameter> is not specified,
|
|
the last opened dictionary is used.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.crack-getlastmessage">
|
|
<refnamediv>
|
|
<refname>crack_getlastmessage</refname>
|
|
<refpurpose>Returns the message from the last obscure check</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcprototype>
|
|
<funcdef>string <function>crack_getlastmessage</function></funcdef>
|
|
<void/>
|
|
</funcprototype>
|
|
</funcsynopsis>
|
|
&warn.experimental.func;
|
|
<para>
|
|
<function>crack_getlastmessage</function> returns the message from the
|
|
last obscure check.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
</reference>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
--> |