Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96202 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98230 invoked from network); 4 Oct 2016 01:40:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2016 01:40:24 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:42876] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/D9-06241-48803F75 for ; Mon, 03 Oct 2016 21:40:22 -0400 Received: (qmail 103412 invoked by uid 89); 4 Oct 2016 01:40:17 -0000 Received: from unknown (HELO mail-qt0-f179.google.com) (yohgaki@ohgaki.net@209.85.216.179) by 0 with ESMTPA; 4 Oct 2016 01:40:17 -0000 Received: by mail-qt0-f179.google.com with SMTP id m5so31788197qtb.3 for ; Mon, 03 Oct 2016 18:40:17 -0700 (PDT) X-Gm-Message-State: AA6/9RncpwB4LysSMsO3CkD4O/jjtYeI8jV0BD6mBRDVf1wKYcS51ZCBinOZMLTE8zYueyniX1wbHyqrdH9DoQ== X-Received: by 10.237.56.34 with SMTP id j31mr1116056qte.16.1475545210624; Mon, 03 Oct 2016 18:40:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.84.168 with HTTP; Mon, 3 Oct 2016 18:39:30 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Oct 2016 10:39:30 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Leigh Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC][DISCUSSION] Improve uniqid() uniqueness From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi Leigh, On Mon, Oct 3, 2016 at 9:06 PM, Leigh wrote: > I'm curious, did you consider using random_int? It already handles > biasing, and you can reduce the repeated calls to random_bytes. Yes. It seemed it might be slower due to number of retries at first, but I realized that it isn't later. It could be something like $entropy = random_int(10000000000, 9999999999); $entropy[1] = '.'; $uniqid = timestamp . $entropy; I don't have particular preference. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net