← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 1193899] Re: Incorrect hasher for class CID.

 

[Expired for DC++ because there has been no activity for 60 days.]

** Changed in: dcplusplus
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/1193899

Title:
  Incorrect hasher for class CID.

Status in DC++:
  Expired

Bug description:
  Please replace the incorrect class hasher CID, on hasher, taking into
  account all the data, and as a consequence. eliminating collisions.
  This change will increase the efficiency of search hashing.

  #include <boost/functional/hash.hpp>

  class CID
  {
  ...
  		size_t toHash() const
  		{
  			return boost::hash<uint8_t[SIZE]>()(cid);
  		}
  ...
  };

  namespace std
  {
  template<>
  struct hash<CID>
  {
  	size_t operator()(const CID& rhs) const
  	{
  		return rhs.toHash();
  	}
  };

  template<>
  struct hash<CID*>
  {
  	size_t operator()(const CID* rhs) const
  	{
  		return rhs->toHash();
  	}
  };

  ...

  }

  Original commit from FlylinkDC++:
  https://code.google.com/p/flylinkdc/source/detail?r=14282 and
  https://code.google.com/p/flylinkdc/source/detail?r=14283

To manage notifications about this bug go to:
https://bugs.launchpad.net/dcplusplus/+bug/1193899/+subscriptions


References