<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 09 Jan 2009 22:23:19 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Suspekt Blog: mt_srand and not so random numbers]]></title>
      <guid>http://www.phpdeveloper.org/news/10851</guid>
      <link>http://www.phpdeveloper.org/news/10851</link>
      <description><![CDATA[<p>
<i>Stefan Esser</i> <a href="http://www.suspekt.org/2008/08/17/mt_srand-and-not-so-random-numbers/">points out</a> a problem with the <a href="http://www.php.net/mt_rand">mt_rand</a> and <a href="http://www.php.net/rand">rand</a> methods in PHP that makes them not quite random enough for cryptographic uses.
</p>
<blockquote>
PHP comes with two random number generators named rand() and mt_rand(). The first is just a wrapper around the libc rand() function and the second one is an implementation of the Mersenne Twister pseudo random number generator. Both of these algorithms are seeded by a single 32 bit dword when they are first used in a process or one of the seeding functions srand() or mt_srand() is called.
</blockquote>
<p>
He looks at how its currently implemented, some examples of bad methods to get "random" numbers, how shared resources are a problem and an example of a cross-application attack (the application in more than once place using the same method for getting random numbers). 
</p>
<p>
In the comments he recommends either grabbing from /dev/random (if you're on a unix-based system) or making the creation of your numbers a bit more complex to include things the outside world wouldn't know.
</p>]]></description>
      <pubDate>Mon, 18 Aug 2008 13:49:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevX.com: A Guide to Cryptography in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/10123</guid>
      <link>http://www.phpdeveloper.org/news/10123</link>
      <description><![CDATA[<p>
The DevX.com site has posted an <a href="http://www.devx.com/webdev/Article/37821">introductory guide</a> to using cryptography in PHP, showing how to use the various packages the language has to offer.
</p>
<blockquote>
Cryptography is just one piece of the security puzzle, along with SSL/TLS, certificates, digital signatures, and so on. This article explains how to use PHP to implement the most common cryptographic algorithms. In addition to describing PHP's default encryption functions, you'll see how to use a wide variety of cryptographic libraries and packages.
</blockquote>
<p>
They start with a look at some of the built-in functions like md5, sh1 and crypt as well as a table detailing the different encryption methods (like mcrypt, mhash or crypt_blowfish). They follow this up with examples of some of them including a method for making secret keys with the <a href="http://pear.php.net/package/Crypt_DiffieHellman">Crypt_DiffieHellman PEAR Package</a>.
</p>]]></description>
      <pubDate>Tue, 06 May 2008 13:47:22 -0500</pubDate>
    </item>
  </channel>
</rss>
