<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP UUID generator function</title>
	<atom:link href="http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/</link>
	<description>Exploring PHP, MySql, Javascript, jQuery, Zend Framework and more... from Bangladesh</description>
	<lastBuildDate>Sat, 20 Mar 2010 09:10:04 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ??????? &#187; [Web] ????</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-3537</link>
		<dc:creator>??????? &#187; [Web] ????</dc:creator>
		<pubDate>Wed, 25 Nov 2009 02:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-3537</guid>
		<description>[...] PHP UUID generator function [...]</description>
		<content:encoded><![CDATA[<p>[...] PHP UUID generator function [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan Kulkarni</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-2937</link>
		<dc:creator>Roshan Kulkarni</dc:creator>
		<pubDate>Tue, 08 Sep 2009 04:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-2937</guid>
		<description>I recently used a UUID generation scheme for a project which is described:

&lt;a href=&quot;http://roshankulkarni.info/?p=3&quot; rel=&quot;nofollow&quot;&gt;http://roshankulkarni.info/?p=3&lt;/a&gt;

This was used on a distributed application with about 4 PHP servers and a few million database records. The application was not very mission critical.

While this scheme is not cryptographically secure - it worked well in our scenario and offered a good key distribution and a low collision probability.</description>
		<content:encoded><![CDATA[<p>I recently used a UUID generation scheme for a project which is described:</p>
<p><a href="http://roshankulkarni.info/?p=3" rel="nofollow">http://roshankulkarni.info/?p=3</a></p>
<p>This was used on a distributed application with about 4 PHP servers and a few million database records. The application was not very mission critical.</p>
<p>While this scheme is not cryptographically secure &#8211; it worked well in our scenario and offered a good key distribution and a low collision probability.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AWS SimpleDB &#171; Chris Royles</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-2936</link>
		<dc:creator>AWS SimpleDB &#171; Chris Royles</dc:creator>
		<pubDate>Mon, 07 Sep 2009 21:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-2936</guid>
		<description>[...] as a means of uniquely tagging each &#8216;item&#8217; in SimpleDB. This makes updated much easier. PHP UUID generator function  &lt;?php  /**   * Generates an UUID   *    * @author     Anis uddin Ahmad [...]</description>
		<content:encoded><![CDATA[<p>[...] as a means of uniquely tagging each &#8216;item&#8217; in SimpleDB. This makes updated much easier. PHP UUID generator function  &lt;?php  /**   * Generates an UUID   *    * @author     Anis uddin Ahmad [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Urban</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-2667</link>
		<dc:creator>Thomas Urban</dc:creator>
		<pubDate>Thu, 16 Apr 2009 16:23:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-2667</guid>
		<description>You missed to include proper markers for the version of UUIDs you&#039;re generating. Probably most systems might ignore this, but some might reject to work with e.g. version 1 UUID. So here is another approach to properly generate version 4 UUIDs:


mt_srand( intval( microtime( true ) * 1000 ) );
$b = md5( uniqid( mt_rand(), true ), true );
$b[6] = chr( ( ord( $b[6] ) &amp; 0x0F ) &#124; 0x40 );
$b[8] = chr( ( ord( $b[8] ) &amp; 0x3F ) &#124; 0x80 );
return implode( &#039;-&#039;, unpack( &#039;H8a/H4b/H4c/H4d/H12e&#039;, $b ) );

I&#039;ve included a time-based seeding of RNG, which might be relocated to a separate method as it isn&#039;t intended to be done that frequently as on each call for generating another UUID but once a runtime ...</description>
		<content:encoded><![CDATA[<p>You missed to include proper markers for the version of UUIDs you&#8217;re generating. Probably most systems might ignore this, but some might reject to work with e.g. version 1 UUID. So here is another approach to properly generate version 4 UUIDs:</p>
<p>mt_srand( intval( microtime( true ) * 1000 ) );<br />
$b = md5( uniqid( mt_rand(), true ), true );<br />
$b[6] = chr( ( ord( $b[6] ) &amp; 0&#215;0F ) | 0&#215;40 );<br />
$b[8] = chr( ( ord( $b[8] ) &amp; 0&#215;3F ) | 0&#215;80 );<br />
return implode( &#8216;-&#8217;, unpack( &#8216;H8a/H4b/H4c/H4d/H12e&#8217;, $b ) );</p>
<p>I&#8217;ve included a time-based seeding of RNG, which might be relocated to a separate method as it isn&#8217;t intended to be done that frequently as on each call for generating another UUID but once a runtime &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anis Ahmad</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-1540</link>
		<dc:creator>Anis Ahmad</dc:creator>
		<pubDate>Wed, 24 Dec 2008 06:42:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-1540</guid>
		<description>Thnaks david,
I&#039;ve tried to update the method of getting random string based on you comment.
Hope it&#039;s stronger at the point of randomaization now.

Thanks again for your comment</description>
		<content:encoded><![CDATA[<p>Thnaks david,<br />
I&#8217;ve tried to update the method of getting random string based on you comment.<br />
Hope it&#8217;s stronger at the point of randomaization now.</p>
<p>Thanks again for your comment</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-1539</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 23 Dec 2008 23:04:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-1539</guid>
		<description>*Use this function at your own risk*

To quote Wikipedia:

&quot;The probability [of generating a duplicate UUID] also depends on the quality of the random number generator. A cryptographically secure pseudorandom number generator must be used to generate the values, otherwise the probability of duplicates may be significantly higher.&quot;

This function has no proof that it meets the standards for a &quot;cryptographically secure pseudorandom number generator&quot;.  It also doesn&#039;t conform to any of the Version 1 thru 5 method of generating a string with sufficient randomness.

In other words, the chances of generating duplicate UUIDs may be unacceptably high when using this function.</description>
		<content:encoded><![CDATA[<p>*Use this function at your own risk*</p>
<p>To quote Wikipedia:</p>
<p>&#8220;The probability [of generating a duplicate UUID] also depends on the quality of the random number generator. A cryptographically secure pseudorandom number generator must be used to generate the values, otherwise the probability of duplicates may be significantly higher.&#8221;</p>
<p>This function has no proof that it meets the standards for a &#8220;cryptographically secure pseudorandom number generator&#8221;.  It also doesn&#8217;t conform to any of the Version 1 thru 5 method of generating a string with sufficient randomness.</p>
<p>In other words, the chances of generating duplicate UUIDs may be unacceptably high when using this function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clancy</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-1537</link>
		<dc:creator>Clancy</dc:creator>
		<pubDate>Thu, 18 Dec 2008 16:36:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-1537</guid>
		<description>@Chris

Thanks for the heads up, but the poster at php.net has fundametally misunserstood what a hash collision is or means - a hash collision is where the chances of finding two different input strings which produce the same hash are reduced enough to (arguably, in theory only) warrant implementing the vast computing power necessary to do so, and offers no guarantees as to the clashing string&#039;s usefulness in any security context.  As security holes go, md5 clashes receive rather more press than they deserve.

A &lt;a href=&quot;http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Definition&quot; rel=&quot;nofollow&quot;&gt;UUID (wikipedia)&lt;/a&gt; is a 16-byte (128-bit) number. The number of theoretically possible UUIDs is therefore 216*8 = 2128 = 25616 or about 3.4 Ã— 1038. This means that 1 trillion UUIDs would have to be created every nanosecond for slightly more than 10 billion years to exhaust the number of UUIDs.

Whilst a Crptographicall Secure Pseudo Random number Generator is recommended for generating UUIDs, I&#039;d hedge a bet that if you were to make up the UUIDS for a database of 100M entries yourself from imagination alone, we&#039;d be pretty safe against clashes :)</description>
		<content:encoded><![CDATA[<p>@Chris</p>
<p>Thanks for the heads up, but the poster at php.net has fundametally misunserstood what a hash collision is or means &#8211; a hash collision is where the chances of finding two different input strings which produce the same hash are reduced enough to (arguably, in theory only) warrant implementing the vast computing power necessary to do so, and offers no guarantees as to the clashing string&#8217;s usefulness in any security context.  As security holes go, md5 clashes receive rather more press than they deserve.</p>
<p>A <a href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Definition" rel="nofollow">UUID (wikipedia)</a> is a 16-byte (128-bit) number. The number of theoretically possible UUIDs is therefore 216*8 = 2128 = 25616 or about 3.4 Ã— 1038. This means that 1 trillion UUIDs would have to be created every nanosecond for slightly more than 10 billion years to exhaust the number of UUIDs.</p>
<p>Whilst a Crptographicall Secure Pseudo Random number Generator is recommended for generating UUIDs, I&#8217;d hedge a bet that if you were to make up the UUIDS for a database of 100M entries yourself from imagination alone, we&#8217;d be pretty safe against clashes <img src='http://www.ajaxray.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-411</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 29 Jul 2008 12:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-411</guid>
		<description>the guys posting on the php docs for uniqid() function (http://php.net/uniqid) raise a good point that it might be better to feed the output from md5 into uniqid() rather than the other way around.  md5() generates hashes and therefore you are taking a chance of a collision by accident.

just a quick fix:
-    $chars = md5(uniqid(rand()));
+    $chars = uniqid(md5(rand()));

thanks for a quick function to make uuids.</description>
		<content:encoded><![CDATA[<p>the guys posting on the php docs for uniqid() function (<a href="http://php.net/uniqid" rel="nofollow">http://php.net/uniqid</a>) raise a good point that it might be better to feed the output from md5 into uniqid() rather than the other way around.  md5() generates hashes and therefore you are taking a chance of a collision by accident.</p>
<p>just a quick fix:<br />
-    $chars = md5(uniqid(rand()));<br />
+    $chars = uniqid(md5(rand()));</p>
<p>thanks for a quick function to make uuids.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daws</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-312</link>
		<dc:creator>daws</dc:creator>
		<pubDate>Sun, 30 Mar 2008 22:45:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-312</guid>
		<description>Excellent function. Gets rid of the need for PECL. Thank you!</description>
		<content:encoded><![CDATA[<p>Excellent function. Gets rid of the need for PECL. Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP Universal Feed Generator (supports RSS 1.0, RSS 2.0 and ATOM) &#124; ajaXray</title>
		<link>http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/comment-page-1/#comment-310</link>
		<dc:creator>PHP Universal Feed Generator (supports RSS 1.0, RSS 2.0 and ATOM) &#124; ajaXray</dc:creator>
		<pubDate>Sat, 08 Mar 2008 19:48:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/2008/02/06/php-uuid-generator-function/#comment-310</guid>
		<description>[...] UUID for ATOM [...]</description>
		<content:encoded><![CDATA[<p>[...] UUID for ATOM [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
