MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CServiceHash

Class CServiceHash

src/netaddress.h:571–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569};
570
571class CServiceHash
572{
573public:
574 CServiceHash()
575 : m_salt_k0{FastRandomContext().rand64()},
576 m_salt_k1{FastRandomContext().rand64()}
577 {
578 }
579
580 CServiceHash(uint64_t salt_k0, uint64_t salt_k1) : m_salt_k0{salt_k0}, m_salt_k1{salt_k1} {}
581
582 size_t operator()(const CService& a) const noexcept
583 {
584 CSipHasher hasher(m_salt_k0, m_salt_k1);
585 hasher.Write(a.m_net);
586 hasher.Write(a.port);
587 hasher.Write(a.m_addr);
588 return static_cast<size_t>(hasher.Finalize());
589 }
590
591private:
592 const uint64_t m_salt_k0;
593 const uint64_t m_salt_k1;
594};
595
596#endif // BITCOIN_NETADDRESS_H

Callers 2

RelayAddressMethod · 0.85
FUZZ_TARGETFunction · 0.85

Calls

no outgoing calls

Tested by 1

FUZZ_TARGETFunction · 0.68