| 559 | }; |
| 560 | |
| 561 | class CServiceHash |
| 562 | { |
| 563 | public: |
| 564 | CServiceHash() |
| 565 | : m_salt_k0{GetRand(std::numeric_limits<uint64_t>::max())}, |
| 566 | m_salt_k1{GetRand(std::numeric_limits<uint64_t>::max())} |
| 567 | { |
| 568 | } |
| 569 | |
| 570 | CServiceHash(uint64_t salt_k0, uint64_t salt_k1) : m_salt_k0{salt_k0}, m_salt_k1{salt_k1} {} |
| 571 | |
| 572 | size_t operator()(const CService& a) const noexcept |
| 573 | { |
| 574 | CSipHasher hasher(m_salt_k0, m_salt_k1); |
| 575 | hasher.Write(a.m_net); |
| 576 | hasher.Write(a.port); |
| 577 | hasher.Write(a.m_addr.data(), a.m_addr.size()); |
| 578 | return static_cast<size_t>(hasher.Finalize()); |
| 579 | } |
| 580 | |
| 581 | private: |
| 582 | const uint64_t m_salt_k0; |
| 583 | const uint64_t m_salt_k1; |
| 584 | }; |
| 585 | |
| 586 | #endif // BITCOIN_NETADDRESS_H |
no outgoing calls