Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87212 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18558 invoked from network); 20 Jul 2015 16:30:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2015 16:30:02 -0000 Authentication-Results: pb1.pair.com header.from=codekestrel@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=codekestrel@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: codekestrel@googlemail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:36374] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/C0-11248-8022DA55 for ; Mon, 20 Jul 2015 12:30:01 -0400 Received: by wicgb10 with SMTP id gb10so31554476wic.1 for ; Mon, 20 Jul 2015 09:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ZSdISDjIdw0UAlkU0nQ++2d+vjVGw8oZ+81fSaZku7Y=; b=0YzSyxtJsCLgntv/Y2wCYKHW59+lEtIX2S0s0Osj7hEkHieKTawaU234RW5eU1jzcF ofZtpKiiEJ/S5BEiDcDIZbKzKh08PLSeqzA1GJ827Nk48gcbFiu5BfxADQZSdMRUk7i3 Vq+RLa6mrl6JcFqO1FEsUHQNPMnCYEdrcHXaJdkaPGnopPM9vJOqzZXCIy+dgcJhYDC+ B1FSg4Z2IyisxFnfV9S5PPeM96vftqZ22VipGArk2uckibS3SKa8gSDJhRt2uGXb1FQ7 PYK58iYzUf+X6F4jln3SOOhPHSpxZytev9OCmFjsgMkNKCWTuYrhs0njNNEvwxzoHGz7 H+Lg== MIME-Version: 1.0 X-Received: by 10.194.108.5 with SMTP id hg5mr61201173wjb.25.1437409797357; Mon, 20 Jul 2015 09:29:57 -0700 (PDT) Received: by 10.27.22.20 with HTTP; Mon, 20 Jul 2015 09:29:57 -0700 (PDT) Received: by 10.27.22.20 with HTTP; Mon, 20 Jul 2015 09:29:57 -0700 (PDT) Date: Mon, 20 Jul 2015 17:29:57 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=089e0103defa5e4593051b510c5d Subject: Expanded variable hash function From: codekestrel@googlemail.com (Dominic Grostate) --089e0103defa5e4593051b510c5d Content-Type: text/plain; charset=UTF-8 Hi all. I've been experimenting with creating data structures in PHP. For example I implemented a HashSet which turns out to have a higher performance on larger sets than running in_array on arrays on add. To do this I has to create a hash code generator which could hash scalar types and objects. Other arrays and resources are invalid in my experiment for use as keys. I'd like to request a feature alternative to spl_object_hash that can safely hash any value save the two types I mentioned. The issue with simply hashing a string to sha1 and sha1ing the result of spl_object_hash is the possibility of collisions since a string can be equal to the hash of an object. This requires salting the values with something defining their types, which is what I have done. However my solution, although relatively fast, feels very unconventional, and desires a natively supported option. Thanks, Dominic --089e0103defa5e4593051b510c5d--