Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112553 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70453 invoked from network); 19 Dec 2020 07:01:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Dec 2020 07:01:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 948EB1804F3 for ; Fri, 18 Dec 2020 22:33:45 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 18 Dec 2020 22:33:45 -0800 (PST) Received: by mail-ej1-f50.google.com with SMTP id 6so6361792ejz.5 for ; Fri, 18 Dec 2020 22:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=yqiyH0QHJ2QFCyol+zSfO5lU50vYAlAwmsfP51mhtQM=; b=CrOYo13JYieXExJq9qJMU1dPZVCyByjgM3WuJvfkEtbzY8I0/ss5iZ3uE0WJ7B5LMa ISXdT60eVEQUWB5kGICrtxJRXladJUzBPVPPM4Lxg9qFje0+qnJjZa+ePT+kYRuFxNXW R7FpJXn2mqc/TZ8BOgv0wMptMo4yifil8NNs7fcj+v4ZnlxJusrfoNer+oSIb/IBjH4D I0EZlDGda34l1J3KXbLMlf5U8FsuQmPvi0JqhZBxAD6CewXP4lp7BI/tRhA1SoyMWE1A lry9998ITaNa8/gfAiInYSx5nIVtyEkzxFDOBUPLFTdnW7Mf7GvotEaNV7TM7eOgLU+D l+KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=yqiyH0QHJ2QFCyol+zSfO5lU50vYAlAwmsfP51mhtQM=; b=fol8xPwph9rz5VcGZBpyOet+MiExtNaCrSqG1GgdniwhFPn7lQypgVF6uxrGtZ1tl6 tYnKZ67NmGKDUe93u0kkZZgNbyr5mpVL9iayLK6rZpmkMcoP3aeLXEC8DWdxykaVsa4w 6VVGZWLtL4vVmS1FDhoaVJ/IF0HOQb42SrQq8Ej3lMO1onSNvoC1QWNuVtJh777Mz8NB AwTa2U6Wm0GA22XDUZmDkos/H4DR6KuvnYMWV7jAlgSWOdbzo9EIOq1fhDrk4ZK3/6Qe AJOyBkg1bqRGLkS8CzrqB0HUq8S1MtO3dRJnirj0PG1kKBiHtIYo2aPpPWaJGwNvjY71 SB0A== X-Gm-Message-State: AOAM533Jbyt44aP14kMeoZu11ajyNw5DSe9K1118cSi4jAhiBE+kDZw/ 1h1teA57VOFlpbjrzIO7OoIRgzsNYjSvMfPbjndyf6NwjoI+RQ== X-Google-Smtp-Source: ABdhPJzJ3g0MYQOmx3+QDwORfcc+WTgHzkDgBQo0MHf4hDhXu1XsvJRiFZvoTTEII05BKxNYUFj40B9qRUn8aE7sHgg= X-Received: by 2002:a17:906:edd1:: with SMTP id sb17mr7194689ejb.118.1608359619974; Fri, 18 Dec 2020 22:33:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 19 Dec 2020 15:33:29 +0900 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000d1d86c05b6cb6774" Subject: Re: Improving PRNG implementation. From: zeriyoshi@gmail.com (zeriyoshi) --000000000000d1d86c05b6cb6774 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 16, 2020 at 8:46 AM zeriyoshi wrote: Hello. I have created an account on the PHP.net wiki to create an RFC about this. Can you grant me editing privileges? As for suggestion two, I sent a PR to php-src on GitHub. https://github.com/php/php-src/pull/6520 Fortunately, Nikita seems to be checking it out. Thank you very much. P.S: I had mentioned earlier that php_combined_lcg() was used in the session, but I checked and it seems not to be the case now. I will correct it. Sorry about that. Regards, Go Kudo 2020=E5=B9=B412=E6=9C=8816=E6=97=A5(=E6=B0=B4) 23:46 zeriyoshi : > Nice to meet you, internals. > > PHP 8.0 has been released. With the inclusion of JIT, PHP is about to be > extended beyond the web. > > So I'd like to make a few suggestions. > > First , PHP has the historical Mersenne Twister PRNG. However, this > implementation keeps its state in a global and cannot be handled as an > object like other languages (e.g. Java). > > So, I created a PHP Extension and proposed it to PECL. > > https://marc.info/?l=3Dpecl-dev&m=3D160795415604102&w=3D2 > https://github.com/zeriyoshi/php-ext-orng > > But, Then I looked at the mailing list archives and noticed that a simila= r > proposal had been made before. > > https://externals.io/message/98021#98130 > > I feel that this suggestion is needed now to expand PHP beyond the web. > > Second suggestion is to stop using the Combined LCG as the default seed > value for each function. > > PHP's Combined LCG only uses PID (or ZTS Thread ID) and time as entropy. > https://github.com/php/php-src/blob/master/ext/standard/lcg.c#L72 > > With the development of container technology, this problem seems to be > getting more serious. So I think we should use the random numbers provide= d > by the OS (getrandom on Linux) if available. > > I would like to hear your opinions. > > Regards > Go Kudo > --000000000000d1d86c05b6cb6774--