Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97999 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11298 invoked from network); 28 Jan 2017 00:06:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2017 00:06:52 -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:47790] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 77/3D-28703-990EB885 for ; Fri, 27 Jan 2017 19:06:51 -0500 Received: (qmail 6230 invoked by uid 89); 28 Jan 2017 00:06:44 -0000 Received: from unknown (HELO mail-wm0-f51.google.com) (yohgaki@ohgaki.net@74.125.82.51) by 0 with ESMTPA; 28 Jan 2017 00:06:44 -0000 Received: by mail-wm0-f51.google.com with SMTP id r126so139060687wmr.0 for ; Fri, 27 Jan 2017 16:06:44 -0800 (PST) X-Gm-Message-State: AIkVDXIk5W2mOM8Xk2OPsmIjPieEvpIY6tUBvREevsu6Wp1ztz/KG/yoe0U/nUPn7GZ2L+qqPMXWevcUsBToLg== X-Received: by 10.28.22.146 with SMTP id 140mr4940067wmw.22.1485561997666; Fri, 27 Jan 2017 16:06:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.195.12.8 with HTTP; Fri, 27 Jan 2017 16:05:56 -0800 (PST) In-Reply-To: References: <71c26cd6df6f59e76dafd31647852c2e@koti.fimnet.fi> <142a3537a99809cf23d78e0eaadc3aef@gmail.com> <7a359bb08b0ad8b046534c15492cec91@gmail.com> Date: Sat, 28 Jan 2017 09:05:56 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Nikita Popov Cc: =?UTF-8?Q?Lauri_Kentt=C3=A4?= , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1145bd0c29b5fc05471c5bfb Subject: Re: [PHP-DEV] Re: Improving mt_rand() seed From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1145bd0c29b5fc05471c5bfb Content-Type: text/plain; charset=UTF-8 Hi all, On Wed, Jan 18, 2017 at 3:04 PM, Yasuo Ohgaki wrote: > The patch initializes the full MT state vector, approximately 2.5KB of >> memory, from a CSPRNG. To put this into perspective, 16 bytes are generally >> considered to be sufficient for cryptographic keying material. Does this >> seem somewhat disproportionate? >> > > It could be. I haven't read and research MT rand initialization code > carefully yet. > According to reference implementation referred by MT rand author, state buffer initialization by CSPRNG should be safe. See init_by_array(). http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/mt19937ar-nrl.c Basically, this code is trying to randomize state buffer w/o real RNG. Therefore, replacing it by CSPRNG is OK. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1145bd0c29b5fc05471c5bfb--