Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72053 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3758 invoked from network); 3 Feb 2014 08:00:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 08:00:20 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.52 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.52 mail-qa0-f52.google.com Received: from [209.85.216.52] ([209.85.216.52:38878] helo=mail-qa0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/B4-15628-29C4FE25 for ; Mon, 03 Feb 2014 03:00:19 -0500 Received: by mail-qa0-f52.google.com with SMTP id j15so9659435qaq.11 for ; Mon, 03 Feb 2014 00:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GiY4FrFZMY/vcyC3ZdbOmBi6H/e82ADj2hPvdXem0dY=; b=Qf4FcEy45oMJxqLGNT+c9dxpYtzEEPYVR8qjOOiihOHbJmXU2Xz3Oxk/GGKwkrk7Tm nw8M782xpoQaw6jGmqQeAk1GpyMO5maIsjw5GlNdSh+QVo6yQ7YnFVXy2PZD31bAVUAc V5UwX+PDO7S9F2w+P5lGDcEuvxVw5vs3JMDANdQWcRf//GK7DINB31hxAPrCma5+Ihdx L6Uh1gsiquQ+VtPKSAnmWFeXHQNsNX8z1lVHb+jNN2QnNsotk4c10SjoHtaSt2B6HUm3 2WiXFuT5X1fbO5jmEE6fy/6bAbs2UCUPfJv/5fAXPwlZI9tRbt58yfo4bZZ5Rhovdfo+ C/Qw== MIME-Version: 1.0 X-Received: by 10.140.48.172 with SMTP id o41mr50952294qga.16.1391414415514; Mon, 03 Feb 2014 00:00:15 -0800 (PST) Received: by 10.140.18.129 with HTTP; Mon, 3 Feb 2014 00:00:15 -0800 (PST) In-Reply-To: References: <52EDF552.4010208@divbyzero.net> Date: Mon, 3 Feb 2014 09:00:15 +0100 Message-ID: To: Tjerk Meesters Cc: Yasuo Ohgaki , Martin Jansen , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Extending uniqid() or not? From: pierre.php@gmail.com (Pierre Joye) On Mon, Feb 3, 2014 at 8:45 AM, Tjerk Meesters wrote: > The RFC [1] states v4 is used with truly-random or pseudo-random number > generators; it would be up to us to decide whether LCG is pseudo-random > enough :) Every RNG we use are "pseudo-random enough" :) However it is important to distinguish crypto safe (f.e. /dev/random ), strong (f.e. urandom), weak (mt_rand) or totally pointless (rand ;), not sure about the working for the last one. For UUID, strong are good enough. Crypto safe would be a overhead and could be raise more issues that we try to solve, like over use crypto safe entropy source way too much. > The generated values should be hard to guess, which typically means LCG > would not be suitable. The function (if implemented) could issue a warning > or notice if a preferred RNG could not be used, even though > `password_hash()` doesn't do this in the same scenario. > As we are mainly talking about sessions here, it is important to keep an eye on what is done: http://lxr.php.net/xref/PHP_5_5/ext/session/session.c#345 as you can see it already relies on good enough RNG on all platforms, as long as the entropy source and length are set correctly: http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-file About uniqid not being safe, that's fine. It is known and now well documented (afair it was the case before too, at least for the unsafe part). -- Pierre @pierrejoye | http://www.libgd.org