develooper Front page | perl.perl5.porters | Postings from February 2000

Re: [PATCH 5.5.660] improved semantics for assign to pseudohash

From:
Ilya Zakharevich
Date:
February 26, 2000 21:10
Subject:
Re: [PATCH 5.5.660] improved semantics for assign to pseudohash
Message ID:
200002270510.AAA28834@monk.mps.ohio-state.edu
Gurusamy Sarathy writes:
> for their hashes, but use Perl's internal hash table routines.  This might
> make sense if you have a custom data set on which Perl's algorithm performs
> poorly (as it is known to on keys that are repeating sequences).

This remark is a year (or two) too late.

There are no known "natural" vulnerabilities of the current hashing
code.  Note "hash quality" below, and the fill-histograms on the ARRAY
line.  [Well, x 6 or x 26 give much worse results, but still not
catastrophic.]

Ilya

monk:~/perl/perl5.5.640->./perl -Ilib -MDevel::Peek -e '$h{$_ x 8}++ for "a" ..
"z"; Dump \%h'
SV = RV(0x19d810) at 0x184834
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x1a407c
  SV = PVHV(0x194438) at 0x1a407c
    REFCNT = 2
    FLAGS = (SHAREKEYS)
    IV = 26
    NV = 0
    ARRAY = 0x184230  (0:15, 1:8, 2:9)
    hash quality = 107.1%
    KEYS = 26
    FILL = 17
    MAX = 31
    RITER = -1
    EITER = 0x0
    Elt "qqqqqqqq" HASH = 0x55f22a80
    SV = NV(0x194098) at 0x1a7798
      REFCNT = 1
      FLAGS = (NOK,pNOK)
      NV = 1
    Elt "bbbbbbbb" HASH = 0xdb6302e0
    SV = NV(0x194020) at 0x17f220
      REFCNT = 1
      FLAGS = (NOK,pNOK)
      NV = 1
    Elt "yyyyyyyy" HASH = 0x31fa3fa2
    SV = NV(0x1940d8) at 0x18481c
      REFCNT = 1
      FLAGS = (NOK,pNOK)
      NV = 1



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About