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())
44 std::memcpy(
id.data(), result.data(), result.size());
53 auto const result = parseBase58<AccountID>(jv.
asString());
61 boost::optional<AccountID>
67 if (!
id.SetHex(s,
true))
73 boost::optional<AccountID>
76 auto result = parseHex<AccountID>(s);
78 result = parseBase58<AccountID>(s);
124 static_assert(
sizeof(d) ==
id.size(),
"");
132 static AccountID const account(beast::zero);
146 if (s.
size() == (160 / 4))
151 auto const account = parseBase58<AccountID>(s);
180 auto iter =
m1_.find(
id);
181 if (iter !=
m1_.end())
185 if (iter !=
m0_.end())
187 result = iter->second;
202 m1_.emplace(
id, result);
std::uint8_t const * data() const noexcept
AccountIDCache(AccountIDCache const &)=delete
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.
std::string decodeBase58Token(std::string const &s, TokenType type)
Decode a token of given type encoded using Base58Check and the XRPL alphabet.
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.
std::string encodeBase58Token(TokenType type, void const *token, std::size_t size)
Encode data in Base58Check format using XRPL alphabet.
boost::optional< AccountID > parseHexOrBase58(std::string const &s)
Parse AccountID from hex or checked base58 string.
bool deprecatedParseBase58(AccountID &account, Json::Value const &jv)
boost::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
AccountID const & noAccount()
A placeholder for empty accounts.
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
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.