message: Use SipHash-2-4 for address relay selection
diff: @@ -5334,25 +5334,23 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
  LOCK(cs_vNodes);
  // Use deterministic randomness to send to the same nodes for 24 hours
  // at a time so the addrKnowns of the chosen nodes prevent repeats
  - static uint256 hashSalt;
  - if (hashSalt.IsNull())
  - hashSalt = GetRandHash();
  + static uint64_t salt0 = 0, salt1 = 0;
  + while (salt0 == 0 && salt1 == 0) {
  + GetRandBytes((unsigned char*)&salt0, sizeof(salt0));
  + GetRandBytes((unsigned char*)&salt1, sizeof(salt1));
  + }
  uint64_t hashAddr = addr.GetHash();
  - uint256 hashRand = hashSalt ^ (hashAddr << 32) ^ ((GetTime() + hashAddr) / (24 * 60 * 60));
  - hashRand = Hash(BEGIN(hashRand), END(hashRand));
  - std::multimap<uint256, CNode*> mapMix;
  + std::multimap<uint64_t, CNode*> mapMix;
  + const CSipHasher hasher = CSipHasher(salt0, salt1).Write(hashAddr << 32).Write((GetTime() + hashAddr) / (24*60*60));
  for (CNode* pnode : vNodes) {
  if (pnode->nVersion < CADDR_TIME_VERSION)
  continue;
  - unsigned int nPointer;
  - memcpy(&nPointer, &pnode, sizeof(nPointer));
  - uint256 hashKey = hashRand ^ nPointer;
  - hashKey = Hash(BEGIN(hashKey), END(hashKey));
  + uint64_t hashKey = CSipHasher(hasher).Write(pnode->id).Finalize();
  mapMix.insert(std::make_pair(hashKey, pnode));
  }
  int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s)
  FastRandomContext insecure_rand;
  - for (std::multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
  + for (auto mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
  ((*mi).second)->PushAddress(addr, insecure_rand);
  }
  }
  