本文整理汇总了C++中CUInt128::ToHex方法的典型用法代码示例。如果您正苦于以下问题:C++ CUInt128::ToHex方法的具体用法?C++ CUInt128::ToHex怎么用?C++ CUInt128::ToHex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUInt128
的用法示例。
在下文中一共展示了CUInt128::ToHex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: STR
CKademlia::CKademlia(uint16 Port, bool bIPv6, const CVariant& Config, const string& Version)
{
m_Protocol = KAD_PROT_VER;
if(!Version.empty())
m_Version += Version;
else
m_Version = "v " STR(KAD_PROT_MJR) "." STR(KAD_PROT_MIN);
m_pConfig = new CKadConfig(this);
if(Config.IsValid())
m_pConfig->Merge(Config);
LoadData();
if(m_pKadKey->GetAlgorithm() == CAbstractKey::eUndefined)
{
m_pKadKey->SetAlgorithm(CAbstractKey::eECP);
//m_pKadKey->GenerateKey("secp256r1"); // NIST: P-256
m_pKadKey->GenerateKey("brainpoolP256r1"); // dont trust NIST (NSA) curves, use brainpool
LogLine(LOG_INFO, L"Generated new Private NodeKey");
SaveData();
}
m_pSocket = new CSmartSocket(SEC2MS(Cfg()->GetInt("ConnectionTimeout")), this);
CScoped<CPublicKey> pKey = m_pKadKey->PublicKey();
CUInt128 ID;
CKadID::MakeID(pKey, ID.GetData(), ID.GetSize());
LogLine(LOG_INFO, L"Neo Kad ID: %s", ID.ToHex().c_str());
uint64 RecvKey;
CAbstractKey::Fold(ID.GetData(), ID.GetSize(),(byte*)&RecvKey, sizeof(RecvKey));
m_pSocket->SetupCrypto(RecvKey, m_pKadKey);
#ifdef _DEBUG
LogLine(LOG_INFO, L"Socket PassKey is %I64u", RecvKey);
#endif
m_Port = 0;
m_IPv4 = CAddress(CAddress::IPv4);
m_IPv6 = CAddress(CAddress::IPv6);
for(int i=Port; i < Port + 1000; i++)
{
CUTPSocketListner* pSocketListner = new CUTPSocketListner(m_pSocket);
CUTPSocketListner* pSocketListnerV6 = bIPv6 ? new CUTPSocketListner(m_pSocket) : NULL;
bool bV4 = pSocketListner->Bind(i, CAddress(CAddress::IPv4));
bool bV6 = !pSocketListnerV6 || pSocketListnerV6->Bind(i, CAddress(CAddress::IPv6));
if(bV4 && bV6)
{
m_pSocket->InstallListener(pSocketListner);
if(pSocketListnerV6)
m_pSocket->InstallListener(pSocketListnerV6);
m_Port = i;
break;
}
delete pSocketListner;
delete pSocketListnerV6;
}
}