Alphabet class for base58 conversions, Validators work

This commit is contained in:
Vinnie Falco
2013-10-03 18:29:30 -07:00
parent 7d089561c3
commit 66a272debd
21 changed files with 468 additions and 220 deletions

View File

@@ -62,10 +62,10 @@ void CBase58Data::SetData (int nVersionIn, const unsigned char* pbegin, const un
SetData (nVersionIn, (void*)pbegin, pend - pbegin);
}
bool CBase58Data::SetString (const char* psz, unsigned char version, const char* pAlphabet)
bool CBase58Data::SetString (const char* psz, unsigned char version, Base58::Alphabet const& alphabet)
{
Blob vchTemp;
Base58::decodeWithCheck (psz, vchTemp, pAlphabet);
Base58::decodeWithCheck (psz, vchTemp, alphabet);
if (vchTemp.empty () || vchTemp[0] != version)
{

View File

@@ -47,7 +47,7 @@ protected:
void SetData (int nVersionIn, const unsigned char* pbegin, const unsigned char* pend);
public:
bool SetString (const char* psz, unsigned char version, const char* pAlphabet = Base58::getCurrentAlphabet ());
bool SetString (const char* psz, unsigned char version, Base58::Alphabet const& alphabet = Base58::getCurrentAlphabet ());
bool SetString (const std::string& str, unsigned char version);
std::string ToString () const;

View File

@@ -348,7 +348,7 @@ std::string RippleAddress::humanAccountID () const
}
}
bool RippleAddress::setAccountID (const std::string& strAccountID, const char* pAlphabet)
bool RippleAddress::setAccountID (const std::string& strAccountID, Base58::Alphabet const& alphabet)
{
if (strAccountID.empty ())
{
@@ -358,7 +358,7 @@ bool RippleAddress::setAccountID (const std::string& strAccountID, const char* p
}
else
{
mIsValid = SetString (strAccountID.c_str (), VER_ACCOUNT_ID, pAlphabet);
mIsValid = SetString (strAccountID.c_str (), VER_ACCOUNT_ID, alphabet);
}
return mIsValid;

View File

@@ -95,7 +95,7 @@ public:
std::string humanAccountID () const;
bool setAccountID (const std::string& strAccountID, const char* pAlphabet = Base58::getCurrentAlphabet ());
bool setAccountID (const std::string& strAccountID, Base58::Alphabet const& alphabet = Base58::getCurrentAlphabet ());
void setAccountID (const uint160& hash160In);
static RippleAddress createAccountID (const std::string& strAccountID)