MCPcopy Create free account
hub / github.com/ElementsProject/elements / CServiceHash

Class CServiceHash

src/netaddress.h:561–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559};
560
561class CServiceHash
562{
563public:
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
581private:
582 const uint64_t m_salt_k0;
583 const uint64_t m_salt_k1;
584};
585
586#endif // BITCOIN_NETADDRESS_H

Callers 2

RelayAddressMethod · 0.85
FUZZ_TARGETFunction · 0.85

Calls

no outgoing calls

Tested by 1

FUZZ_TARGETFunction · 0.68