• Raymond Hettinger's avatar
    Futher improvements to frozenset hashing (based on Yitz Gale's battery of · c978633e
    Raymond Hettinger yazdı
    tests which nicely highly highlight weaknesses).
    
    * Initial value is now a large prime.
    * Pre-multiply by the set length to add one more basis of differentiation.
    * Work a bit harder inside the loop to scatter bits from sources that
      may have closely spaced hash values.
    
    All of this is necessary to make up for keep the hash function commutative.
    Fortunately, the hash value is cached so the call to frozenset_hash() will
    only occur once per set.
    c978633e
setobject.c 25.5 KB