Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42728 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73297 invoked from network); 20 Jan 2009 13:23:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2009 13:23:55 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.159 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 72.14.220.159 fg-out-1718.google.com Received: from [72.14.220.159] ([72.14.220.159:41497] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/E2-57672-960D5794 for ; Tue, 20 Jan 2009 08:23:54 -0500 Received: by fg-out-1718.google.com with SMTP id 16so1373650fgg.23 for ; Tue, 20 Jan 2009 05:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=b0z81G4NX2l65UUu1j41JjgeeRO+ztu1rRrODL8JA/A=; b=lVAtYqADWd3xFH+rjTxnEh8NxXgIApB6RN3tx3tjI5th5NlJ2XZrdsrMnLaBYaf/nb 1JCj/hjarDRtUdjdb/Vmc8w0c8OxoXo4LUgGkTtFaVXomnKw1ZbxI9znjKdO75FhymYW LRZ2fkQC9w482zzQKW4Mp2QpUMJJrgE6eG/7s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=gWqZk1SkkFcadig5JrMWvtCX5EMej8U9probT6F3dxHf2SnaNS1PfotzTtxHmETieU JuNY6qbKH8j5LzAdGbPf/nKiYNnsMnFSMilnB+neV1KzIEMM5llmEH5J3WCCL8dIIB/t EfxI8SwBe+MOzXriSgdt4I7ZhkdDQYfgz4huc= Received: by 10.86.52.6 with SMTP id z6mr748892fgz.63.1232457831306; Tue, 20 Jan 2009 05:23:51 -0800 (PST) Received: by 10.86.35.9 with HTTP; Tue, 20 Jan 2009 05:23:51 -0800 (PST) Message-ID: Date: Tue, 20 Jan 2009 14:23:51 +0100 Sender: ekneuss@gmail.com To: "Guilherme Blanco" Cc: "Stan Vassilev | FM" , "internals Mailing List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1229538590.4955.15.camel@localhost> <28434894.20081217221911@marcus-boerger.de> X-Google-Sender-Auth: 930a3481deb6a213 Subject: Re: [PHP-DEV] New function proposal: spl_object_id From: webmaster@colder.ch ("Etienne Kneuss") Hello, On Tue, Jan 20, 2009 at 1:45 PM, Guilherme Blanco wrote: > Hi, > > It seems SplObjectStorage will solve my issue. > We already spoke on pvt about how to handle things correctly too. > > Although this solve my issue, the point that Stan highlighted is > valid. You may not find a good place where to use it, but > spl_object_hash is there and it has drawbacks. Just naming collision > possibility is enough to convince me about function change, even > though I can't imagine a usage of it now. > > If none can find a usage, so we can drop spl_object_hash, right? This is not possible for BC reasons. Also, changing it internally so it no longer returns a md5 hash might be doable but it will have some BC effects as well. If those effects are considered to be harmless, then sure, I'd be happy to make that function faster by implementing what was discussed before. > If > you don't agree, then we need some change to make it faster and > non-collision proof. > > > Regards, Regards, > > On Tue, Jan 20, 2009 at 10:26 AM, Etienne Kneuss wr= ote: >> Hello, >> >> On Tue, Jan 20, 2009 at 11:47 AM, Stan Vassilev | FM >> wrote: >>> >>> Hi, >>> >>> I had a talk with Marcus, and he has agreed on this proposed solution: >>> >>> 1) SPL generates a pseudo-random session id/mask (for the current reque= st, >>> do not confuse with $_SESSION), which consists of 32 random >>> bytes/characters. >>> 2) The object is and the handler pointer are used to create a unique >>> identifier for the object, by padding each pointer to 16 bytes and join= ing >>> them together. >>> 3) The resulting byte sequence is XOR-red with the session mask so the >>> object id/handler are not retrievable in userland, and the resulting >>> sequence/string is returned. >>> >>> This is better than spl_object_hash for two reasons: >>> >>> 1) no printf of numbers, no expensive md5 hashing, no hex conversion. >>> 2) no possible collisions >>> >>> Drawbacks: >>> >>> 1) might generate some non-printable chars after xor (but this wouldn't >>> matter for operation). The idea above can be tweaked to solve this. >>> >>> The "32-bit string" format is to preserve compatibility with >>> spl_object_hash, so it can replace it, instead of introducing a new sim= ilar >>> function. >>> >>> I've had no time to look further into this, but Marcus seems to like th= e >>> basic idea, so feel welcome... >> >> Could you please provide an example, with code, in which this function >> would be necessary ? (i.e. where you can't use SplObjeccctStorage) >> >> Thanks. >> >>> >>> Regards, >>> Stan Vassilev >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >>> >>> >> >> >> >> -- >> Etienne Kneuss >> http://www.colder.ch >> >> Men never do evil so completely and cheerfully as >> when they do it from a religious conviction. >> -- Pascal >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Guilherme Blanco - Web Developer > CBC - Certified Bindows Consultant > Cell Phone: +55 (16) 9215-8480 > MSN: guilhermeblanco@hotmail.com > URL: http://blog.bisna.com > S=E3o Paulo - SP/Brazil > --=20 Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal