dave Wed Aug 4 12:43:12 2004 EDT
Modified files:
/phpdoc/en/reference/strings/functions crypt.xml
Log:
- Add an example to crypt() showing the usage of the various encryption
types.
http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/crypt.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/strings/functions/crypt.xml
diff -u phpdoc/en/reference/strings/functions/crypt.xml:1.5
phpdoc/en/reference/strings/functions/crypt.xml:1.6
--- phpdoc/en/reference/strings/functions/crypt.xml:1.5 Mon Jul 5 11:05:25 2004
+++ phpdoc/en/reference/strings/functions/crypt.xml Wed Aug 4 12:43:12 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.crypt">
<refnamediv>
@@ -75,7 +75,7 @@
<listitem>
<simpara>
CRYPT_BLOWFISH - Blowfish encryption with a sixteen character salt
- starting with $2$
+ starting with $2$ or $2a$
</simpara>
</listitem>
</itemizedlist>
@@ -120,6 +120,37 @@
?>
]]>
</programlisting>
+ </example>
+ <example>
+ <title>Using <function>crypt</function> with different encryption types</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+if (CRYPT_STD_DES == 1)
+ echo 'Standard DES: ' . crypt('rasmuslerdorf', 'rl') . "\n";
+
+if (CRYPT_EXT_DES == 1)
+ echo 'Extended DES: ' . crypt('rasmuslerdorf', '_J9..rasm') . "\n";
+
+if (CRYPT_MD5 == 1)
+ echo 'MD5: ' . crypt('rasmuslerdorf', '$1$rasmusle$') . "\n";
+
+if (CRYPT_BLOWFISH == 1)
+ echo 'Blowfish: ' . crypt('rasmuslerdorf', '$2a$07$rasmuslerd...........$') .
"\n";
+?>
+]]>
+ </programlisting>
+ <para>
+ The above example will output something similar to:
+ </para>
+ <screen>
+<![CDATA[
+Standard DES: rl.3StKT.4T8M
+Extended DES: _J9..rasmBYk8r9AiWNc
+MD5: $1$rasmusle$rISCgZzpwk3UhDidwXvin0
+Blowfish: $2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra
+]]>
+ </screen>
</example>
<simpara>
See also <function>md5</function> and <link linkend="ref.mcrypt">the