bool AddressBook::GetIdentHash (const std::string& address, i2p::data::IdentHash& ident) { auto pos = address.find(".b32.i2p"); if (pos != std::string::npos) { Base32ToByteStream (address.c_str(), pos, ident, 32); return true; } else { pos = address.find (".i2p"); if (pos != std::string::npos) { auto identHash = FindAddress (address); if (identHash) { ident = *identHash; return true; } else return false; } } // if not .b32 we assume full base64 address i2p::data::IdentityEx dest; if (!dest.FromBase64 (address)) return false; ident = dest.GetIdentHash (); return true; }
void NetDb::RequestDestination (const char * b32, const uint8_t * router) { uint8_t destination[32]; Base32ToByteStream (b32, strlen(b32), destination, 32); RequestDestination (destination, router); }