Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117302 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90258 invoked from network); 11 Mar 2022 09:55:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Mar 2022 09:55:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 98BEA1804D9 for ; Fri, 11 Mar 2022 03:19:04 -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,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (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, 11 Mar 2022 03:19:04 -0800 (PST) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-2db2add4516so89694617b3.1 for ; Fri, 11 Mar 2022 03:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colopl.co.jp; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=e0xSwdq8NJAlaTJRBsfV+YR/Pwfb4T4I9GFlnFwCyOQ=; b=DhIwWt2nY72wRD7L65UxBiFr4RnkQT0NjGQrt7F5rvaA5koPUC3nLoDSYRdjblWr7Q 7JegFTm8GFRu/huyVGMdNiPiHkfpWkWVY26wscNSIk8J1T6IZX2AoRJGs0Sd1rIAzBGj HSKbUb9t5Cyx/zLDDo8MQlnzfbTVQJkm4M9of6kYI56YXTfBlUhiY+VnBlL/Ysksh/3a oANLAcPHgIKIanMgH5e40yEhGMnW/vPsbDZ9D9K4vWwcss46sfP9/pgshnMGSQt6mh7T tVheYI+IARok2m4ZGi49PtKp3+stGoRG96SHW+n1L9uwSVL9tG+InbkeTGlm+Ga2v30n pMAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=e0xSwdq8NJAlaTJRBsfV+YR/Pwfb4T4I9GFlnFwCyOQ=; b=8DffuiOZtPyoQRM1W3vqx4Yv/3StrPik6ONiUgx1T7lLvj+zV0cgdiH1GMbCdWn1Lo CrpXasE3xOU/+PcDHCo76nZZm4AE1Mom8uEKMtOrlB7J571X1VJgNduc8ac2z4gi4Fqh 6vOp+2/nlzAiHiZCqtUpmJEpXHe0uM+uYdpyqIvirTgN+ebQ7Z/qksndEB3UF9CUxoWp zmt27WUxlA4DdvVEx5ibzDYqjfnuu29BKIDpRRYDlIqwQtUS3q8aUTDKIdalltHSdtIG 0vbMFCpi9kNpX66ZppfKKKTBDDs6QK+4xYpbGesr5ORUvBKB6kixwfxFNX+/q/PDvzF2 F9bg== X-Gm-Message-State: AOAM5338MymoNgzqlCWa5UM2bMREWyCqNb+rDn2Dcj3vJY4j/9bTum3E HqF/i4aBvMUeN51nWgrSCYdt4JBdm9WKGppKemxj X-Google-Smtp-Source: ABdhPJwQ1zftI29mH3I07o2gIrdZ5uahRyKiYpONbnX6jpthYiDJJz1Y/IJ9qc1cFjUgEd4SS5QeDKccKzqECsBZz1M= X-Received: by 2002:a0d:ccd4:0:b0:2dc:a03:761 with SMTP id o203-20020a0dccd4000000b002dc0a030761mr7364870ywd.315.1646997543604; Fri, 11 Mar 2022 03:19:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 11 Mar 2022 20:18:52 +0900 Message-ID: To: Larry Garfield Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000088724405d9ef7f7a" Subject: Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension 5.x From: g-kudo@colopl.co.jp (Go Kudo) --00000000000088724405d9ef7f7a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2022=E5=B9=B43=E6=9C=8810=E6=97=A5(=E6=9C=A8) 3:07 Larry Garfield : > On Wed, Mar 9, 2022, at 4:48 AM, Go Kudo wrote: > > Hello internals. > > > > Proposed RFCs and implementations have been reorganized. The main chang= es > > are as follows > > > > https://wiki.php.net/rfc/rng_extension > > https://github.com/php/php-src/pull/8094 > > > > - Remove XorShift128Plus, Xoshiro256StarStar > > - To avoid confusion, Can be added if needed > > - All classes can now omit the seed argument > > - Seeding with CSPRNG > > - Throws RuntimeException if number generation fails > > > > The merge window to PHP 8.2 will remain open for some time to come. Due > to > > the global turmoil, I will try to delay the start of the RFC voting pha= se > > as long as possible. > > > > However, I believe that PHP RFCs tend to become more controversial once > the > > voting phase begins. > > > > Therefore, I would like to solicit feedback on this RFC, whatever it ma= y > > be. (Just only positive or negative feedback would be okay) > > > > Regards, > > Go Kudo > > This looks good to me overall, although I have a few comments. > > * There's several places where a sentence or portion of a sentence repeat= s > itself. I assume this is just an editing error. > > * The list headers "implemented of" doesn't really make grammatical > sense. I think you mean "implemented by"? > > * The last section "PRNG Shootout" seems to imply that you're only > implementing one algorithm, but it doesn't say which one. The earlier > sections, though, show several algorithms that you are implementing. > Again, I assume this is an editing error from many revisions but it's > confusing as is. > > * If no engine is provided to the randomizer, what gets used? If the > default is listed somewhere in the RFC, I missed it. I'm assuming there > should be one, for usability, but changing it in the future would be an > RFC-level change (much like changing the defaults for password_hash()). > > * The example of using different algorithms in different environments > needs much higher billing. You're burying the lead there. The ability t= o > have a bad but predictable random seed for tests but then a CSPRNG for > production is *huge*. The approach is similar to the nearly-done PSR-20 > spec in FIG, which does essentially the same thing for the "current time" > routines, albeit in userspace. I would highlight this benefit way more, = as > it's probably the biggest benefit from these changes that most developers > will see and has me more excited about this RFC than anything else in the > entire document. > > * How do the existing random functions interact with the new API? Do the= y > shift to be shells over the new classes with an internal shared global, o= r > something else? > > * A side effect of the current design is that SeedableEngine is just a > marker interface; there's no actual standardized way to set the seed. Th= e > examples imply that passing it as a constructor is the recommended way (a= nd > I agree it probably should be), but that's not explicit. I'm also unclea= r > then what value the marker interface is, then. Does the randomizer do > something different with a seedable engine? I'm not against the current > design, but its explanation/implications could be improved. > > Looking forward to this passing in a few weeks! > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Hi Larry, I have attempted to correct what you pointed out. However, I don't think the RFC is complete at this point. We will work on correcting this over the next few days. I'll answer a few questions. (These have been corrected in the RFC) > If no engine is provided to the randomizer, what gets used? If the default is listed somewhere in the RFC, I missed it. I'm assuming there should be one, for usability, but changing it in the future would be an RFC-level change (much like changing the defaults for password_hash()). As Tim has answered, Random\Engine\Secure is automatically generated and used. > The example of using different algorithms in different environments needs much higher billing This is a very important aspect, but also a side effect of the current problem solving. I am very concerned about how to appeal to this. For the time being, I have added a sentence to the Proposal. > How do the existing random functions interact with the new API As BC break is none, it does not affect existing APIs. The internal implementation will be changed. This is to avoid redundancy in implementation. https://github.com/php/php-src/pull/8094/files#diff-8ba10cd3f979cdab4491a2d= 02149ff10638b88854e79664748b3ab620fd3f1bfR255-R259 I am very concerned about how to make the RFC easier to read. I Will continue to work on improving it. Regards Go Kudo --00000000000088724405d9ef7f7a--