Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102109 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28300 invoked from network); 12 May 2018 22:47:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2018 22:47:35 -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:45840] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/00-28281-30F67FA5 for ; Sat, 12 May 2018 18:47:34 -0400 Received: (qmail 50606 invoked by uid 89); 12 May 2018 22:46:49 -0000 Received: from unknown (HELO mail-io0-f177.google.com) (yohgaki@ohgaki.net@209.85.223.177) by 0 with ESMTPA; 12 May 2018 22:46:49 -0000 Received: by mail-io0-f177.google.com with SMTP id g1-v6so11093555iob.2 for ; Sat, 12 May 2018 15:46:48 -0700 (PDT) X-Gm-Message-State: ALKqPwe0M3u7hH/4bfkkyj9e/p2ssIxo0kMfmed3/9XyuBoPfgdNUzap EFgfqtEtNiWJjwgNXhRknGV0+NzUWzrgB89NdA== X-Google-Smtp-Source: AB8JxZqgrQpoEXfhjaOVdT1kxhwxtiMqzlNL0YU+zl1bHNjDdp3/rYpSwTkQaY+8+/s+zTXfuQM1soqZN0B2dI7Vuc0= X-Received: by 2002:a6b:9bcc:: with SMTP id d195-v6mr4496036ioe.15.1526165202741; Sat, 12 May 2018 15:46:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:240b:0:0:0:0:0 with HTTP; Sat, 12 May 2018 15:46:02 -0700 (PDT) In-Reply-To: References: Date: Sun, 13 May 2018 07:46:02 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Alice Wonder Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000c7449c056c0a064d" Subject: Re: [PHP-DEV] [RFC] Deprecation of uniqid() From: yohgaki@ohgaki.net (Yasuo Ohgaki) --000000000000c7449c056c0a064d Content-Type: text/plain; charset="UTF-8" On Fri, May 11, 2018 at 9:34 PM, Alice Wonder wrote: > slightly better if block > > if($more_entropy) { > sodium_increment($nonce); > $x = hexdec(substr(bin2hex($nonce),0,12)); > $return = $return . substr($x, 2, 1) . '.' . substr($x, -8); > } > > Obvious patterns in the "more entropy" but the output in only suppose to > be unique, not random. The most important issue in current uniqid() is it could have duplicate even with $more_entropy=true, since it has + structure. System time could be adjusted backwards by ntp, etc. However changing output by default as follows is enough for it. + uniqid() is one of the most abused function in PHP. I don't have strong opinion against uniqid() deprecation, though. Regards, -- Yasuo Ohgaki --000000000000c7449c056c0a064d--