"Eugene Scripnik" wrote: ... > $ cat myhash.rb > class MyHash < Hash > def hash > current = 17 > self.each do |k, v| > current = current * 37 + k.hash > current = current * 37 + v.hash > end Your Hash is not (in this case each enumerate) order independent either (i.e. it's possible that hash1 == hash2 is true but hash1.hash == hash2.hash is false) - just use a simple summation on the key-value pair similar to my previous post def hash inject(17) {|hsh,pair| hsh + pair[0]^(pair[1]<< 2) } end > return current > end > > def eql?( h ) > return false if self.keys.length != h.keys.length > h.each do |k, v| > return false unless self.has_key?( k ) and self[k] == v > end > return true > end or equivalently alias eql? == > end /Christoph