svn: /phpdoc/ doc-base/trunk/entities/global.ent en/trunk/reference/strings/functions/crypt.xml

From: Date: Mon, 15 Feb 2010 12:13:37 +0000
Subject: svn: /phpdoc/ doc-base/trunk/entities/global.ent en/trunk/reference/strings/functions/crypt.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-6063@lists.php.net to get a copy of this message
joey Mon, 15 Feb 2010 12:13:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295093 Log: 1) Fix the current Blowfish documentation. It was pretty horribly wrong, which Solar Designer pointed out to us quite a while back [1]. I more or less copied the way the Perl package Crypt::Eksblowfish::Bcrypt documents it, with a few modifications to make it fit better with how PHP uses it. 2) Document the new (as of 5.3.2) CRYPT_SHA_256 and CRYPT_SHA_512 constants (and the salt format that goes with them), as well as include the examples. [1] http://markmail.org/message/k3tzsrahlketfj5K Changed paths: U phpdoc/doc-base/trunk/entities/global.ent U phpdoc/en/trunk/reference/strings/functions/crypt.xml Modified: phpdoc/doc-base/trunk/entities/global.ent =================================================================== --- phpdoc/doc-base/trunk/entities/global.ent 2010-02-15 06:44:40 UTC (rev 295092) +++ phpdoc/doc-base/trunk/entities/global.ent 2010-02-15 12:13:37 UTC (rev 295093) @@ -56,6 +56,7 @@ <!ENTITY url.comspecs "http://www.microsoft.com/Com/resources/comdocs.asp"> <!ENTITY url.connectionstrings "http://www.connectionstrings.com/"> <!ENTITY url.cpdf "http://www.fastio.com/"> +<!ENTITY url.crypt.sha "http://people.redhat.com/drepper/SHA-crypt.txt"> <!ENTITY url.crack "http://sourceforge.net/projects/cracklib"> <!ENTITY url.curl "http://curl.haxx.se/"> <!ENTITY url.curl.error "http://curl.haxx.se/libcurl/c/libcurl-errors.html"> Modified: phpdoc/en/trunk/reference/strings/functions/crypt.xml =================================================================== --- phpdoc/en/trunk/reference/strings/functions/crypt.xml 2010-02-15 06:44:40 UTC (rev 295092) +++ phpdoc/en/trunk/reference/strings/functions/crypt.xml 2010-02-15 12:13:37 UTC (rev 295093) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision$ --> -<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.crypt"> +<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.crypt"> <refnamediv> <refname>crypt</refname> <refpurpose>One-way string encryption (hashing)</refpurpose> @@ -62,10 +62,33 @@ </listitem> <listitem> <simpara> - <constant>CRYPT_BLOWFISH</constant> - Blowfish encryption with a sixteen character salt - starting with $2$ or $2a$ + <constant>CRYPT_BLOWFISH</constant> - Blowfish encryption with a salt as follows: + "$2", optional "a", "$", a two digit cost parameter, "$", and 22 base 64 digits. The presence + of the optional "a" means that a NUL is to be appended to the password before it is used as a + key. The two digits set the cost parameter, where the output will be fed back into the Blowfish + cipher 2^cost times. </simpara> </listitem> + <listitem> + <simpara> + <constant>CRYPT_SHA256</constant> - SHA-256 encryption with a sixteen character salt + prefixed with $5$. If the salt string starts with 'rounds=&lt;N&gt;$', the numeric value of N + is used to indicate how many times the hashing loop should be executed, much like the cost + parameter on Blowfish encryption. The default number of rounds is 5000, there is a minimum of + 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to + the nearest limit. + </simpara> + </listitem> + <listitem> + <simpara> + <constant>CRYPT_SHA512</constant> - SHA-512 encryption with a sixteen character salt + prefixed with $6$. If the salt string starts with 'rounds=&lt;N&gt;$', the numeric value of N + is used to indicate how many times the hashing loop should be executed, much like the cost + parameter on Blowfish encryption. The default number of rounds is 5000, there is a minimum of + 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to + the nearest limit. + </simpara> + </listitem> </itemizedlist> <note> <para> @@ -125,6 +148,13 @@ </thead> <tbody> <row> + <entry>5.3.2</entry> + <entry> + Added SHA-256 and SHA-512 crypt based on Ulrich Drepper's + <link xlink:href="&url.crypt.sha;">implementation</link>. + </entry> + </row> + <row> <entry>5.3.0</entry> <entry> PHP now contains its own implementation for the MD5 crypt, Standard DES, @@ -197,6 +227,14 @@ if (CRYPT_BLOWFISH == 1) { echo 'Blowfish: ' . crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$') . "\n"; } + +if (CRYPT_SHA256 == 1) { + echo 'SHA-256: ' . crypt('rasmuslerdorf', '$5$rounds=5000$usesomesillystringforsalt$') . "\n"; +} + +if (CRYPT_SHA512 == 1) { + echo 'SHA-512: ' . crypt('rasmuslerdorf', '$5$rounds=5000$usesomesillystringforsalt$') . "\n"; +} ?> ]]> </programlisting> @@ -207,6 +245,8 @@ Extended DES: _J9..rasmBYk8r9AiWNc MD5: $1$rasmusle$rISCgZzpwk3UhDidwXvin0 Blowfish: $2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi +SHA-256: $5$rounds=5000$usesomesillystri$KqJWpanXZHKq2BOB43TSaYhEWsQ1Lr5QNyPCDH/Tp.6 +SHA-512: $6$rounds=5000$usesomesillystri$D4IrlXatmP7rx3P3InaxBeoomnAihCKRVQP22JZ6EY47Wc6BkroIuUUBOov1i.S5KPgErtP/EN5mcO.ChWQW21 ]]> </screen> </example>

« previous php.doc.cvs (#6063) next »