Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58702 invoked from network); 20 Jan 2009 12:26:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2009 12:26:58 -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:32579] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/00-57672-F03C5794 for ; Tue, 20 Jan 2009 07:26:56 -0500 Received: by fg-out-1718.google.com with SMTP id 16so1363075fgg.23 for ; Tue, 20 Jan 2009 04:26:53 -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=HIZsUpdDowZDFPjhLIxFXnXiMUzVaNMcC8RTt8ydDW0=; b=C6j6eZP+NPqxUxdLZh586zhclr5ParrcKBEtQUUpZXDv+ATlPaKzIWTVxUykwl3Oi9 DDmlRctf/pyG9nS5CipmrwUT9tWu1NESkGG58IsmQ8s0QOy1WrdqVLBQiMg4jV9lgM1q YxsJV0qiZB9cib0FB3UDxcvnqEjthe/AwMrxQ= 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=aK4GfmCROs99zT1FryLd461l60a56HGvDRfC9Zp5Ffvf9wMAsz1++qsCJoh2AkycAN LKbz0EV9Mm+teqPwKZEppFkeV++EidiynlZSprJ31rHTMfbmQQQJ6GCPyGLvXybTAwJy MV1J8gV4D13zY7VPRc9R0kSrUWDk831oh9YPw= Received: by 10.86.95.8 with SMTP id s8mr2425471fgb.28.1232454413253; Tue, 20 Jan 2009 04:26:53 -0800 (PST) Received: by 10.86.35.9 with HTTP; Tue, 20 Jan 2009 04:26:53 -0800 (PST) Message-ID: Date: Tue, 20 Jan 2009 13:26:53 +0100 Sender: ekneuss@gmail.com To: "Stan Vassilev | FM" Cc: "internals Mailing List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1229538590.4955.15.camel@localhost> <28434894.20081217221911@marcus-boerger.de> X-Google-Sender-Auth: d6bd21c40d6e4924 Subject: Re: [PHP-DEV] New function proposal: spl_object_id From: webmaster@colder.ch ("Etienne Kneuss") 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 request, > 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 joining > 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 similar > function. > > I've had no time to look further into this, but Marcus seems to like the > 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