Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80423 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45514 invoked from network); 12 Jan 2015 22:42:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2015 22:42:55 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.216.173 mail-qc0-f173.google.com Received: from [209.85.216.173] ([209.85.216.173:55040] helo=mail-qc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/D4-04585-EED44B45 for ; Mon, 12 Jan 2015 17:42:54 -0500 Received: by mail-qc0-f173.google.com with SMTP id i17so20609211qcy.4 for ; Mon, 12 Jan 2015 14:42:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=CrOr/XW5sCuFOm3pFLqKVvnjGnUMK3aBe9cztoSxAXg=; b=dzOCw6gPjbR2Y2sqeicF1+3KWVQfTO3nlDGso38ec9Wkk8ed0jYBYcRKrWsLvRrABs luvhoKqCwSNaAdVqfxmCL6EGSKWVarbMOamdqzFiu9u9lB/sua1R1BV/XLjgFMV0QL3j +1c7BNeFHY8KGYcgCgKhu1mEYQMYNxr/3/ZaNtdpoJCcSbRUZHjt2WmR8J1tp1Ju1i4B 8j0CU3ZaF5z27oWBlf/gCkV8KcSRcrBleuHVZqrbwlBXqvcI1Gh/nErNBXRPZWAxyJ3D +DOhkySG7W3AkHRGkysPG2ISQJteYJwq4iH4unTKnpRPS5LL0fAljD/mbJ4DRk/lFKC9 r/3A== X-Received: by 10.229.114.137 with SMTP id e9mr54175807qcq.0.1421102571227; Mon, 12 Jan 2015 14:42:51 -0800 (PST) Received: from stas-air.corp.wikimedia.org (tan4.corp.wikimedia.org. [198.73.209.4]) by mx.google.com with ESMTPSA id o34sm15999044qge.29.2015.01.12.14.42.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jan 2015 14:42:50 -0800 (PST) Message-ID: <54B3F290.3050909@gmail.com> Date: Mon, 12 Jan 2015 08:13:04 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Andrea Faulds , Rasmus Lerdorf CC: Yasuo Ohgaki , PHP Internals List References: <54B30DB9.3000003@seld.be> <76B8D342-43E7-42E6-AD82-FCF7C5CA8658@ajf.me> <54B31D77.9010100@gmail.com> <976B7B2E-7BC9-4514-ABF3-C0DA3ED98897@ajf.me> <54B32145.80501@gmail.com> <54B32BEA.5090507@gmail.com> <54B38EA6.8070402@lerdorf.com> <47FF88D5-14F8-4844-A9DD-51532FBF3588@ajf.me> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] rand(), mt_rand() and limits From: smalyshev@gmail.com (Stanislav Malyshev) Hi! >> - To produce a repeatable sequence of random numbers (works, but >> only if you and the sole user of the global random number >> generator, which is not guaranteed by any means) If you write your code it is guaranteed. Note that it's not some API we're designing out of the blue, it is something that has been working for years and you propose to just eliminate it because you don't like it. It's not how it should be done in a mature language like PHP. If you want to design better API, please do it, but breaking working APIs is not a good idea. > - To generate cryptographic keys - a seeded random number generator I'm surprised you even bring it up. Yes, it is known rand() should not be used for cryptography. It is true with srand or without srand, and nobody advocated using rand for cryptography. > This is why Suhosin disabled srand by default: it is, unfortunately, > also a security issue. Saying "it's a security issue" is not some magic phrase that instantly makes wrong into right. There's no security issue in srand. Security issue is in wrong usage of rand() and breaking srand() would do nothing to fix it. If you use a tool for a wrong purpose, it is pointless to point each aspect of it and say "that's where the wrong is" if the whole thing altogether is wrong from the premise up. -- Stas Malyshev smalyshev@gmail.com