1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<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>
<methodsynopsis>
<type>resource</type><methodname>crack_opendict</methodname>
<methodparam><type>string</type><parameter>dictionary</parameter></methodparam>
</methodsynopsis>
<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>
<methodsynopsis>
<type>bool</type><methodname>crack_closedict</methodname>
<methodparam choice="opt"><type>resource</type><parameter>dictionary</parameter></methodparam>
</methodsynopsis>
<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>
<methodsynopsis>
<type>bool</type><methodname>crack_check</methodname>
<methodparam choice="opt"><type>resource</type><parameter>dictionary</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<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>
<methodsynopsis>
<type>string</type><methodname>crack_getlastmessage</methodname>
<void/>
</methodsynopsis>
&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
-->
|