Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56998 invoked from network); 3 Feb 2014 11:48:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2014 11:48:56 -0000 Authentication-Results: pb1.pair.com header.from=padraic.brady@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=padraic.brady@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.174 as permitted sender) X-PHP-List-Original-Sender: padraic.brady@gmail.com X-Host-Fingerprint: 209.85.160.174 mail-yk0-f174.google.com Received: from [209.85.160.174] ([209.85.160.174:45344] helo=mail-yk0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/C3-35654-7228FE25 for ; Mon, 03 Feb 2014 06:48:55 -0500 Received: by mail-yk0-f174.google.com with SMTP id 10so37856553ykt.5 for ; Mon, 03 Feb 2014 03:48:53 -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:content-transfer-encoding; bh=KA1XfLDb35v4Fk8hvO8VsgSVJ7L4dHcoAzAm43+XKhA=; b=iPk5nKJEMjZ34h+9B0XcJWWIiJC4POMBbXtro54v5KBMlI/zA6+oK6JUuMu9FTZweq t2EjBDgbViwM9+rzeM977QTrQv5YEMY1Uiy01M+4W6KuBIAeGu3HJWYotvER9jSyVrRR Ku1TLtE0FyZ1njs1n+HqZtZtohyg45kxB7/+6JESPmWB6le0F4q13jWy6lBrg0nS6Xww ZvMF9kYWFpHcRHPvVBsCoZY7AmMZvTjAYd0DfZtiD7y0fw8xvzGgIQwXVx9pEBiZM0j1 pSI0N2OYDUn9lVLFOWB+23hbmlNwglSJoig1MUro0LuMskADhSFwsuJeGMkCW1C484gw qhfg== MIME-Version: 1.0 X-Received: by 10.236.174.37 with SMTP id w25mr32747806yhl.36.1391428132075; Mon, 03 Feb 2014 03:48:52 -0800 (PST) Received: by 10.170.215.130 with HTTP; Mon, 3 Feb 2014 03:48:52 -0800 (PST) In-Reply-To: References: Date: Mon, 3 Feb 2014 11:48:52 +0000 Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Extending uniqid() or not? From: padraic.brady@gmail.com (=?UTF-8?Q?P=C3=A1draic_Brady?=) Hi Yasuo, On 2 February 2014 04:32, Yasuo Ohgaki wrote: > Hi all, > > uniqid() is producing unique ID for the system which is good for email's > message ID etc. Many users are using uniqid() as secure unique ID which i= s > very bad thing to do for security. > > It may be extend to produce safe unique ID > > string uniqid(TRUE) - Returns random ID string which is safe to use > security purposes. > > My concern is that uniqid() return both safe and unsafe ID which may not = be > good. We may better to have new function, perhaps Mildly off-topic, the function has another outcome aside from any pure role as a secure ID generator in that it leaks very specific timing information which could be useful to unfriendly people: $id =3D uniqid(); $time =3D str_split($id, 8); $sec =3D hexdec('0x' . $time[0]); $usec =3D hexdec('0x' . $time[1]); echo 'Seconds: ', $sec, PHP_EOL, 'Microseconds: ', $usec, PHP_EOL; The format is preserved even with additional parameters to the function. Using the function at all is problematic. -- P=C3=A1draic Brady http://blog.astrumfutura.com http://www.survivethedeepend.com Zend Framework Community Review Team Zend Framework PHP-FIG Representative