![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <stdint.h>
#include <string>
#include <vector>
Go to the source code of this file.
Macros | |
#define | BEGIN(a) ((char*)&(a)) |
#define | END(a) ((char*)&((&(a))[1])) |
#define | UBEGIN(a) ((unsigned char*)&(a)) |
#define | UEND(a) ((unsigned char*)&((&(a))[1])) |
#define | ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) |
#define | PAIRTYPE(t1, t2) std::pair<t1, t2> |
Enumerations | |
enum | SafeChars { SAFE_CHARS_DEFAULT, SAFE_CHARS_UA_COMMENT } |
Functions | |
std::string | SanitizeString (const std::string &str, int rule=SAFE_CHARS_DEFAULT) |
std::vector< unsigned char > | ParseHex (const char *psz) |
std::vector< unsigned char > | ParseHex (const std::string &str) |
signed char | HexDigit (char c) |
bool | IsHex (const std::string &str) |
std::vector< unsigned char > | DecodeBase64 (const char *p, bool *pfInvalid=NULL) |
std::string | DecodeBase64 (const std::string &str) |
std::string | EncodeBase64 (const unsigned char *pch, size_t len) |
std::string | EncodeBase64 (const std::string &str) |
std::vector< unsigned char > | DecodeBase32 (const char *p, bool *pfInvalid=NULL) |
std::string | DecodeBase32 (const std::string &str) |
std::string | EncodeBase32 (const unsigned char *pch, size_t len) |
std::string | EncodeBase32 (const std::string &str) |
std::string | i64tostr (int64_t n) |
std::string | itostr (int n) |
int64_t | atoi64 (const char *psz) |
int64_t | atoi64 (const std::string &str) |
int | atoi (const std::string &str) |
bool | ParseInt32 (const std::string &str, int32_t *out) |
bool | ParseInt64 (const std::string &str, int64_t *out) |
bool | ParseDouble (const std::string &str, double *out) |
template<typename T > | |
std::string | HexStr (const T itbegin, const T itend, bool fSpaces=false) |
template<typename T > | |
std::string | HexStr (const T &vch, bool fSpaces=false) |
std::string | FormatParagraph (const std::string &in, size_t width=79, size_t indent=0) |
template<typename T > | |
bool | TimingResistantEqual (const T &a, const T &b) |
bool | ParseFixedPoint (const std::string &val, int decimals, int64_t *amount_out) |
#define ARRAYLEN | ( | array | ) | (sizeof(array)/sizeof((array)[0])) |
Definition at line 20 of file utilstrencodings.h.
Referenced by AvailableDataFormatsString(), CInv::CInv(), CMainParams::CMainParams(), CTestNetParams::CTestNetParams(), CInv::IsKnownType(), ParseDataFormat(), StartREST(), and StopREST().
#define BEGIN | ( | a | ) | ((char*)&(a)) |
Utilities for converting data from/to strings.
Definition at line 16 of file utilstrencodings.h.
Referenced by CPartialMerkleTree::CalcHash(), ComputeMerkleRootFromBranch(), CBlockHeader::GetHash(), RelayAddress(), SendMessages(), and CPartialMerkleTree::TraverseAndExtract().
#define END | ( | a | ) | ((char*)&((&(a))[1])) |
Definition at line 17 of file utilstrencodings.h.
Referenced by CPartialMerkleTree::CalcHash(), ComputeMerkleRootFromBranch(), CBlockHeader::GetHash(), RelayAddress(), SendMessages(), and CPartialMerkleTree::TraverseAndExtract().
#define PAIRTYPE | ( | t1, | |
t2 | |||
) | std::pair<t1, t2> |
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
Definition at line 23 of file utilstrencodings.h.
Referenced by AutoBackupWallet(), CleanupBlockRevFiles(), CKeePassIntegrator::constructHTTPPost(), CWallet::CreateTransaction(), CWallet::DelAddressBook(), CWallet::GetAccountAddresses(), CWallet::GetAddressBalances(), getaddressesbyaccount(), CWallet::GetAddressGroupings(), getchaintips(), CPrivateSend::GetDenominations(), getnetworkinfo(), CMasternodeMan::GetNextMasternodeInQueueForPayment(), GetWarnings(), CRPCTable::help(), listaccounts(), ListReceived(), LoadBlockIndexDB(), WalletModel::loadReceiveRequests(), CWallet::MarkDirty(), masternodelist(), CAlert::ProcessAlert(), ProcessMessage(), PaymentServer::processPaymentRequest(), CWallet::ReacceptWalletTransactions(), AddressTablePriv::refreshAddressTable(), CWallet::ResendWalletTransactionsBefore(), RPCTypeCheckObj(), CWallet::SelectCoinsGrouppedByAddresses(), Solver(), TransactionDesc::toHTML(), CoinControlDialog::updateView(), and WalletTxToJSON().
#define UBEGIN | ( | a | ) | ((unsigned char*)&(a)) |
Definition at line 18 of file utilstrencodings.h.
#define UEND | ( | a | ) | ((unsigned char*)&((&(a))[1])) |
Definition at line 19 of file utilstrencodings.h.
enum SafeChars |
Used by SanitizeString()
Enumerator | |
---|---|
SAFE_CHARS_DEFAULT | The full set of allowed chars. |
SAFE_CHARS_UA_COMMENT | BIP-0014 subset. |
Definition at line 26 of file utilstrencodings.h.
int atoi | ( | const std::string & | str | ) |
Definition at line 541 of file utilstrencodings.cpp.
Referenced by atoi(), CleanupBlockRevFiles(), CWallet::GetMasternodeOutpointAndKeys(), InterpretBool(), masternode(), MutateTxAddInput(), MutateTxDelInput(), MutateTxDelOutput(), MutateTxSign(), ProcessMessage(), and TorControlConnection::readcb().
int64_t atoi64 | ( | const char * | psz | ) |
Definition at line 523 of file utilstrencodings.cpp.
Referenced by GetArg(), getblocktemplate(), MutateTxLocktime(), MutateTxVersion(), ParseMoney(), ParseScript(), ReadOrderPos(), and CWalletTx::SerializationOp().
int64_t atoi64 | ( | const std::string & | str | ) |
Definition at line 532 of file utilstrencodings.cpp.
std::vector<unsigned char> DecodeBase32 | ( | const char * | p, |
bool * | pfInvalid = NULL |
||
) |
Definition at line 299 of file utilstrencodings.cpp.
Referenced by DecodeBase32(), and CNetAddr::SetSpecial().
std::string DecodeBase32 | ( | const std::string & | str | ) |
std::vector<unsigned char> DecodeBase64 | ( | const char * | p, |
bool * | pfInvalid = NULL |
||
) |
Definition at line 146 of file utilstrencodings.cpp.
Referenced by DecodeBase64(), CKeePassIntegrator::CKeePassResponse::decrypt(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CKeePassIntegrator::CKeePassResponse::parseResponse(), RPCAuthorized(), verifymessage(), and voteraw().
std::string DecodeBase64 | ( | const std::string & | str | ) |
std::string EncodeBase32 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
Definition at line 235 of file utilstrencodings.cpp.
Referenced by EncodeBase32(), and CNetAddr::ToStringIP().
std::string EncodeBase32 | ( | const std::string & | str | ) |
std::string EncodeBase64 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
Definition at line 95 of file utilstrencodings.cpp.
Referenced by CKeePassIntegrator::CKeePassRequest::addStrParameter(), CallRPC(), CMasternodeBroadcast::CheckSignature(), EncodeBase64(), masternodebroadcast(), SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), signmessage(), and CHashSigner::VerifyHash().
std::string EncodeBase64 | ( | const std::string & | str | ) |
std::string FormatParagraph | ( | const std::string & | in, |
size_t | width = 79 , |
||
size_t | indent = 0 |
||
) |
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.
Definition at line 478 of file utilstrencodings.cpp.
Referenced by HelpMessageOpt(), and LicenseInfo().
signed char HexDigit | ( | char | c | ) |
Definition at line 54 of file utilstrencodings.cpp.
Referenced by IsHex(), ParseHex(), and base_blob< 512 >::SetHex().
std::string HexStr | ( | const T | itbegin, |
const T | itend, | ||
bool | fSpaces = false |
||
) |
Definition at line 81 of file utilstrencodings.h.
Referenced by TorController::authchallenge_cb(), createmultisig(), CHDChain::Debug(), dumphdinfo(), dumpwallet(), EncodeDumpString(), EncodeHexTx(), CWallet::EncryptWallet(), FormatScript(), GenerateAuthCookie(), getaddressutxos(), getblock(), getblockheader(), getblockheaders(), getblocktemplate(), CDBWrapper::GetObfuscateKeyHex(), gettxoutproof(), HexStr(), listunspent(), masternodebroadcast(), masternodelist(), multiUserAuthorized(), ProcessMessages(), TorController::protocolinfo_cb(), rest_block(), rest_getutxos(), rest_headers(), rest_tx(), ScriptPubKeyToJSON(), ScriptPubKeyToUniv(), ScriptToAsmStr(), ThreadSendAlert(), CTxIn::ToString(), CTxOut::ToString(), TxInErrorToJSON(), TxToJSON(), TxToUniv(), and validateaddress().
|
inline |
Definition at line 100 of file utilstrencodings.h.
std::string i64tostr | ( | int64_t | n | ) |
Definition at line 513 of file utilstrencodings.cpp.
Referenced by getblocktemplate(), and WriteOrderPos().
bool IsHex | ( | const std::string & | str | ) |
std::string itostr | ( | int | n | ) |
Definition at line 518 of file utilstrencodings.cpp.
Referenced by keypoolrefill(), ProcessMessage(), CKeePassIntegrator::rpcAssociate(), CKeePassIntegrator::rpcGetLogins(), CKeePassIntegrator::rpcSetLogin(), and setgenerate().
bool ParseDouble | ( | const std::string & | str, |
double * | out | ||
) |
Convert string to double with strict parse error feedback.
Definition at line 464 of file utilstrencodings.cpp.
Referenced by UniValue::get_real().
bool ParseFixedPoint | ( | const std::string & | val, |
int | decimals, | ||
int64_t * | amount_out | ||
) |
Parse number as fixed point according to JSON number syntax. See http://json.org/number.gif
Definition at line 573 of file utilstrencodings.cpp.
Referenced by AmountFromValue(), and ParsePaymentAmount().
std::vector<unsigned char> ParseHex | ( | const char * | psz | ) |
Definition at line 69 of file utilstrencodings.cpp.
Referenced by _createmultisig_redeemScript(), TorController::authchallenge_cb(), CSporkMessage::CheckSignature(), CMainParams::CMainParams(), CreateGenesisBlock(), CTestNetParams::CTestNetParams(), DecodeHexBlk(), DecodeHexTx(), DecodeHexVecMnb(), CWallet::GenerateNewHDChain(), CGovernanceObject::GetDataAsString(), gobject(), importaddress(), importpubkey(), MutateTxAddOutData(), ParseHex(), ParseHexUV(), ParseHexV(), ParseScript(), rest_getutxos(), CDBEnv::Salvage(), and CProposalValidator::SetHexData().
std::vector<unsigned char> ParseHex | ( | const std::string & | str | ) |
bool ParseInt32 | ( | const std::string & | str, |
int32_t * | out | ||
) |
Convert string to signed 32-bit integer with strict parse error feedback.
Definition at line 433 of file utilstrencodings.cpp.
Referenced by UniValue::get_int(), gobject(), LookupSubNet(), rest_getutxos(), SplitHostPort(), MasternodeList::StartAll(), and MasternodeList::updateMyNodeList().
bool ParseInt64 | ( | const std::string & | str, |
int64_t * | out | ||
) |
Convert string to signed 64-bit integer with strict parse error feedback.
Definition at line 449 of file utilstrencodings.cpp.
Referenced by UniValue::get_int64().
std::string SanitizeString | ( | const std::string & | str, |
int | rule = SAFE_CHARS_DEFAULT |
||
) |
Remove unsafe chars. Safe chars chosen to allow simple messages/URLs/email addresses, but avoid anything even possibly remotely dangerous like & or >
[in] | str | The string to sanitize |
[in] | rule | The set of safe chars to choose (default: least restrictive) |
bool TimingResistantEqual | ( | const T & | a, |
const T & | b | ||
) |
Timing-attack-resistant comparison. Takes time proportional to length of first argument.
Definition at line 117 of file utilstrencodings.h.
Referenced by multiUserAuthorized(), and RPCAuthorized().