<HTML ><HEAD ><TITLE >Crack functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Function Reference" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="cpdf_translate" HREF="function.cpdf-translate.html"><LINK REL="NEXT" TITLE="crack_check" HREF="function.crack-check.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.cpdf-translate.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.crack-check.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.crack" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XI. Crack functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN13686" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.intro" ></A >Introduction</H1 ><P > 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. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.requirements" ></A >Requirements</H1 ><P > More information regarding CrackLib along with the library can be found at <A HREF="http://www.users.dircon.co.uk/~crypto/" TARGET="_top" >http://www.users.dircon.co.uk/~crypto/</A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.installation" ></A >Installation</H1 ><P > In order to use these functions, you must compile PHP with Crack support by using the <TT CLASS="option" >--with-crack[=DIR]</TT > option. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.configuration" ></A >Runtime Configuration</H1 ><P > The behaviour of these functions is affected by settings in <TT CLASS="filename" >php.ini</TT >. </P ><P > <DIV CLASS="table" ><A NAME="AEN13703" ></A ><P ><B >Table 1. Crack configuration options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Name</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Default</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Changeable</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" >crack.default_dictionary</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >NULL</TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >PHP_INI_SYSTEM</TD ></TR ></TBODY ></TABLE ></DIV > For further details and definition of the PHP_INI_* constants see <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.resources" ></A >Resource Types</H1 ><P >This extension has no resource types defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.constants" ></A >Predefined Constants</H1 ><P >This extension has no constants defined.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.examples" ></A >Examples</H1 ><P > This example shows how to open a CrackLib dictionary, test a given password, retrieve any diagnostic messages, and close the dictionary. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN13726" ></A ><P ><B >Example 1. CrackLib example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?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); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > If <A HREF="function.crack-check.html" ><B CLASS="function" >crack_check()</B ></A > returns <TT CLASS="constant" ><B >TRUE</B ></TT >, <A HREF="function.crack-getlastmessage.html" ><B CLASS="function" >crack_getlastmessage()</B ></A > will return 'strong password'. </P ></BLOCKQUOTE ></DIV ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT ><A HREF="function.crack-check.html" >crack_check</A > -- Performs an obscure check with the given password</DT ><DT ><A HREF="function.crack-closedict.html" >crack_closedict</A > -- Closes an open CrackLib dictionary </DT ><DT ><A HREF="function.crack-getlastmessage.html" >crack_getlastmessage</A > -- Returns the message from the last obscure check</DT ><DT ><A HREF="function.crack-opendict.html" >crack_opendict</A > -- Opens a new CrackLib dictionary</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.cpdf-translate.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.crack-check.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >cpdf_translate</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >crack_check</TD ></TR ></TABLE ></DIV ></BODY ></HTML >