From: Ehsanul Hoque Date: 2009-09-11T09:10:15+09:00 Subject: RE: What’s the best general implementation of custom #hash methods? --_f4ae502a-8622-40dd-b037-7d032c2609d9_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable You could check out some of these (in several languages including Ruby): ht= tp://www.partow.net/programming/hashfunctions/#Download > Date: Fri=2C 11 Sep 2009 00:56:14 +0900 > From: shot@hot.pl > Subject: What=92s the best general implementation of custom #hash methods= ? > To: ruby-talk@ruby-lang.org >=20 > Hello=2C ruby-talk. >=20 > What=92s the best (fast=2C yet with relatively few cases when equal hashe= s > are generated for non-eql objects) way to implement a hash method? >=20 > Is XOR-ing the hashes of an object=92s instance variables (assuming that > two objects are eql if their ivars are eql) a good general approach? >=20 > I=92m asking because I use this pattern in my code=2C and it seems quite > fast=3B I needed to work around a bug in MRI=92s Set#hash and this soluti= on=B9 > seems about as fast as the original MRI=92s Set#hash. I=92m just not sure > whether it=92s hashy enough (so to speak) in that two un-eql objects > hashed in this way produce different hashes often enough. >=20 > =B9 http://github.com/Chastell/art-decomp/commit/b465660b9dcc8eada86f50bb= cb8f951aa8145a19 >=20 > =97 Shot > --=20 > Ill-informed qmail-bashing is better than > no qmail-bashing at all. [Don Marti] _________________________________________________________________ Get back to school stuff for them and cashback for you. http://www.bing.com/cashback?form=3DMSHYCB&publ=3DWLHMTAG&crea=3DTEXT_MSHYC= B_BackToSchool_Cashback_BTSCashback_1x1= --_f4ae502a-8622-40dd-b037-7d032c2609d9_--