Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113000 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42327 invoked from network); 27 Jan 2021 13:43:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Jan 2021 13:43:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 52D9B1804A7 for ; Wed, 27 Jan 2021 05:24:57 -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_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 ; Wed, 27 Jan 2021 05:24:56 -0800 (PST) Received: by mail-ed1-f45.google.com with SMTP id g1so2425663edu.4 for ; Wed, 27 Jan 2021 05:24:56 -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 :cc; bh=hfTF5kGaTCfU4cU0ffqvkb3uUH5wRfDknX4SBANOXa0=; b=dGyd9FkDeFyZxoYPvmkwF33xfyDbQbz3VoN4e3BEHv6LmkQ4XxvKkWsjYtU3nGVq+S hAUWdDR7Of9xgMcvdQK7/VPcrnJt2VXaC4tMnVbVEUYeH2iehlX+YF40WetXgy9I0SXF 4bNdqfVqpYVbkT1x5hvKhqIsmA4aVscyEUmkYgAF5tsybAh9ECX2EL3R28r6u8FxkKe8 CNDHASIu/reVPCAinbwitZW1ATF1xPCcWCmUSnR3Wk1NusNcFWd40irIQTVcMthpk21I MphGClnpF4ddhM5Z754lYddqpcRpRgKCqMUDYboqWOHJkLvj5jz0pB3tnEPE+Tx6aHFh ZAPA== 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:cc; bh=hfTF5kGaTCfU4cU0ffqvkb3uUH5wRfDknX4SBANOXa0=; b=He0xRj9EaMuo38MEkOQhJcM2J8n7johSiuKdG8vKXZQFg/oy9EDvqpyaU0B8KBjOS5 3cxoE7DkwTPeKYBbTvHYGZxucz2zhsGlRkp4pC4eBdFZbX8+XUHN8Zqj2oXnzzIoAK1Q RtZZLPEI7J8Q0/rkIzX0aMuzgF1gcnOlVczeg9gr0eo7xnBm7ED3kThYZe07xHfrbH/H yDpr0Q7QCaBpOhcEgZOLQfjfyGgpsYspJ+qtqBhHoqZX8a8/xbawMb3yGwAqzGoH7nvZ scVjtdX19pWdmAEfqPcVHOnaoV+xrezFHMYhaoPls7cDj2sy7PDF0lsWawi+KxY+RFwa cBRw== X-Gm-Message-State: AOAM532utBi2aUD8qW2bIeqFJhEjYRwz6FALla8qduP3JJ5rRUzEEWNC nKB1N3J86Wc7r7anyIHHfI3Vq2Mp5c9XVZ4kKZ0= X-Google-Smtp-Source: ABdhPJyrH2YSu8qH5F6cvvGBUAcX8W8GVT9GqI5RmUR7hnKYXSEWPa+h8CL4lRtHoaAdOwpc1PesF+Oa/OqDrwjE8Xo= X-Received: by 2002:a05:6402:151:: with SMTP id s17mr8511981edu.107.1611753894068; Wed, 27 Jan 2021 05:24:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 27 Jan 2021 15:24:36 +0200 Message-ID: To: Go Kudo Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000005245c405b9e1b2d8" Subject: Re: [PHP-DEV] Re: [RFC] Object-scope RNG implementation From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --0000000000005245c405b9e1b2d8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 26, 2021 at 8:06 PM Go Kudo wrote: > RFCs have been reorganized and radically rewritten. > https://wiki.php.net/rfc/object_scope_prng > > The implementation is unchanged, but the background has been explained in > more detail and the execution speed has been re-verified with PHP 8.1-dev= . > > The proposal seems to have been received relatively positively by > externals, but there hasn't been much reaction. I'm unsure when I should > start voting on this RFC. > > Regards, > Go Kudo > > 2021=E5=B9=B41=E6=9C=889=E6=97=A5(=E5=9C=9F) 19:00 Go Kudo : > > > Hi internals. > > > > I think I'm ready to discuss this RFC. > > https://wiki.php.net/rfc/object_scope_prng > > > > Previous internals thread: https://externals.io/message/112525 > > > > Now is the time to let me know what you think. > > > > Regards, > > Go Kudo > > > Hi Go Kudo, The closest library I know and used when I had that need you mentioned is a userland implementation: https://github.com/paragonie/RandomLib, created by Anthony Ferrara and not maintained by Paragon Initiative Enterprises. The library is organized nicely with a Generator class that depends on constructor of a source for randomness. The source has just a simple method to obtain a specific number of bytes and that's all. I think the naming is what needs more input here. I'm thinking we can also have: - a random bytes source/generator that can be very similar with what you propose: an interface, multiple internal classes, allowing userland extra classes. - a random generator class that would have multiple useful methods like: randomInt($min, $max), randomFloat(), randomBytes($size), randomString($size, $possibleCharacters) etc. As for namings, calling them - RandomGenerator final class that accepts at constructor a - RandomSource interface with one method getBytes($size) implemented by RandomXorShift128PlusSource, RandomMT19937Source, RandomLibsodiumSource, SecureOsSpecificSource etc. is a quick idea from me. State, when is the case, sits in the random source object and can be of course serialized. Other than this, initiative looks good. I apologize if I provided the feedback a bit late. Regards, Alex --0000000000005245c405b9e1b2d8--