20 #include <ripple/protocol/AccountID.h>
21 #include <ripple/protocol/PublicKey.h>
22 #include <ripple/protocol/digest.h>
23 #include <ripple/protocol/tokens.h>
35 boost::optional<AccountID>
42 if (result.size() !=
id.size())
45 result.data(), result.size());
49 boost::optional<AccountID>
56 if (result.size() !=
id.size())
59 result.data(), result.size());
70 parseBase58<AccountID>(jv.
asString());
78 boost::optional<AccountID>
84 if (!
id.SetHex(s,
true))
90 boost::optional<AccountID>
94 parseHex<AccountID>(s);
96 result = parseBase58<AccountID>(s);
140 auto const d =
static_cast<
143 static_assert(
sizeof(d) ==
id.size(),
"");
151 static AccountID const account(beast::zero);
165 if (s.
size () == (160 / 4))
171 parseBase58<AccountID>(s);
193 : capacity_(capacity)
203 auto iter =
m1_.find(
id);
204 if (iter !=
m1_.end())
208 if (iter !=
m0_.end())
210 result = iter->second;
226 m1_.emplace(
id, result);
std::uint8_t const * data() const noexcept
std::string base58EncodeToken(TokenType type, void const *token, std::size_t size)
AccountIDCache(AccountIDCache const &)=delete
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
boost::optional< AccountID > deprecatedParseBitcoinAccountID(std::string const &s)
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
boost::optional< AccountID > parseHex(std::string const &s)
Parse AccountID from hexadecimal string.
constexpr static std::size_t size()
hash_map< AccountID, std::string > m1_
Returns the RIPEMD-160 digest of the SHA256 hash of the message.
std::size_t size() const noexcept
AccountID calcAccountID(PublicKey const &pk)
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
AccountID const & xrpAccount()
Compute AccountID from public key.
hash_map< AccountID, std::string > m0_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
boost::optional< AccountID > parseHexOrBase58(std::string const &s)
Parse AccountID from hex or checked base58 string.
static std::string decodeBase58Token(std::string const &s, TokenType type, InverseArray const &inv)
bool deprecatedParseBase58(AccountID &account, Json::Value const &jv)
std::string decodeBase58TokenBitcoin(std::string const &s, TokenType type)
Decode a Base58 token using Bitcoin alphabet.
boost::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
AccountID const & noAccount()
A placeholder for empty accounts.
std::string toBase58(AccountID const &) const
Return ripple::toBase58 for the AccountID.
bool to_issuer(AccountID &, std::string const &)
Convert hex or base58 string to AccountID.
std::string asString() const
Returns the unquoted string value.