Manual merge of jaromil's source tree reorg commit.
Conflicts: src/sha256.cpp
This commit is contained in:
201
src/base58.h
Normal file
201
src/base58.h
Normal file
@@ -0,0 +1,201 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
//
|
||||
// Why base-58 instead of standard base-64 encoding?
|
||||
// - Don't want 0OIl characters that look the same in some fonts and
|
||||
// could be used to create visually identical looking account numbers.
|
||||
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
|
||||
|
||||
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
||||
|
||||
|
||||
inline string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn0 = 0;
|
||||
|
||||
// Convert big endian data to little endian
|
||||
// Extra zero at the end make sure bignum will interpret as a positive number
|
||||
vector<unsigned char> vchTmp(pend-pbegin+1, 0);
|
||||
reverse_copy(pbegin, pend, vchTmp.begin());
|
||||
|
||||
// Convert little endian data to bignum
|
||||
CBigNum bn;
|
||||
bn.setvch(vchTmp);
|
||||
|
||||
// Convert bignum to string
|
||||
string str;
|
||||
str.reserve((pend - pbegin) * 138 / 100 + 1);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
while (bn > bn0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bn58, pctx))
|
||||
throw bignum_error("EncodeBase58 : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getulong();
|
||||
str += pszBase58[c];
|
||||
}
|
||||
|
||||
// Leading zeroes encoded as base58 zeros
|
||||
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
|
||||
str += pszBase58[0];
|
||||
|
||||
// Convert little endian string to big endian
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
inline string EncodeBase58(const vector<unsigned char>& vch)
|
||||
{
|
||||
return EncodeBase58(&vch[0], &vch[0] + vch.size());
|
||||
}
|
||||
|
||||
inline bool DecodeBase58(const char* psz, vector<unsigned char>& vchRet)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
vchRet.clear();
|
||||
CBigNum bn58 = 58;
|
||||
CBigNum bn = 0;
|
||||
CBigNum bnChar;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// Convert big endian string to bignum
|
||||
for (const char* p = psz; *p; p++)
|
||||
{
|
||||
const char* p1 = strchr(pszBase58, *p);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
if (*p != '\0')
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
bnChar.setulong(p1 - pszBase58);
|
||||
if (!BN_mul(&bn, &bn, &bn58, pctx))
|
||||
throw bignum_error("DecodeBase58 : BN_mul failed");
|
||||
bn += bnChar;
|
||||
}
|
||||
|
||||
// Get bignum as little endian data
|
||||
vector<unsigned char> vchTmp = bn.getvch();
|
||||
|
||||
// Trim off sign byte if present
|
||||
if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80)
|
||||
vchTmp.erase(vchTmp.end()-1);
|
||||
|
||||
// Restore leading zeros
|
||||
int nLeadingZeros = 0;
|
||||
for (const char* p = psz; *p == pszBase58[0]; p++)
|
||||
nLeadingZeros++;
|
||||
vchRet.assign(nLeadingZeros + vchTmp.size(), 0);
|
||||
|
||||
// Convert little endian data to big endian
|
||||
reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool DecodeBase58(const string& str, vector<unsigned char>& vchRet)
|
||||
{
|
||||
return DecodeBase58(str.c_str(), vchRet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline string EncodeBase58Check(const vector<unsigned char>& vchIn)
|
||||
{
|
||||
// add 4-byte hash check to the end
|
||||
vector<unsigned char> vch(vchIn);
|
||||
uint256 hash = Hash(vch.begin(), vch.end());
|
||||
vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4);
|
||||
return EncodeBase58(vch);
|
||||
}
|
||||
|
||||
inline bool DecodeBase58Check(const char* psz, vector<unsigned char>& vchRet)
|
||||
{
|
||||
if (!DecodeBase58(psz, vchRet))
|
||||
return false;
|
||||
if (vchRet.size() < 4)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
uint256 hash = Hash(vchRet.begin(), vchRet.end()-4);
|
||||
if (memcmp(&hash, &vchRet.end()[-4], 4) != 0)
|
||||
{
|
||||
vchRet.clear();
|
||||
return false;
|
||||
}
|
||||
vchRet.resize(vchRet.size()-4);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool DecodeBase58Check(const string& str, vector<unsigned char>& vchRet)
|
||||
{
|
||||
return DecodeBase58Check(str.c_str(), vchRet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ADDRESSVERSION ((unsigned char)(fTestNet ? 111 : 0))
|
||||
|
||||
inline string Hash160ToAddress(uint160 hash160)
|
||||
{
|
||||
// add 1-byte version number to the front
|
||||
vector<unsigned char> vch(1, ADDRESSVERSION);
|
||||
vch.insert(vch.end(), UBEGIN(hash160), UEND(hash160));
|
||||
return EncodeBase58Check(vch);
|
||||
}
|
||||
|
||||
inline bool AddressToHash160(const char* psz, uint160& hash160Ret)
|
||||
{
|
||||
vector<unsigned char> vch;
|
||||
if (!DecodeBase58Check(psz, vch))
|
||||
return false;
|
||||
if (vch.empty())
|
||||
return false;
|
||||
unsigned char nVersion = vch[0];
|
||||
if (vch.size() != sizeof(hash160Ret) + 1)
|
||||
return false;
|
||||
memcpy(&hash160Ret, &vch[1], sizeof(hash160Ret));
|
||||
return (nVersion <= ADDRESSVERSION);
|
||||
}
|
||||
|
||||
inline bool AddressToHash160(const string& str, uint160& hash160Ret)
|
||||
{
|
||||
return AddressToHash160(str.c_str(), hash160Ret);
|
||||
}
|
||||
|
||||
inline bool IsValidBitcoinAddress(const char* psz)
|
||||
{
|
||||
uint160 hash160;
|
||||
return AddressToHash160(psz, hash160);
|
||||
}
|
||||
|
||||
inline bool IsValidBitcoinAddress(const string& str)
|
||||
{
|
||||
return IsValidBitcoinAddress(str.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline string PubKeyToAddress(const vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
return Hash160ToAddress(Hash160(vchPubKey));
|
||||
}
|
||||
532
src/bignum.h
Normal file
532
src/bignum.h
Normal file
@@ -0,0 +1,532 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class bignum_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bignum_error(const std::string& str) : std::runtime_error(str) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAutoBN_CTX
|
||||
{
|
||||
protected:
|
||||
BN_CTX* pctx;
|
||||
BN_CTX* operator=(BN_CTX* pnew) { return pctx = pnew; }
|
||||
|
||||
public:
|
||||
CAutoBN_CTX()
|
||||
{
|
||||
pctx = BN_CTX_new();
|
||||
if (pctx == NULL)
|
||||
throw bignum_error("CAutoBN_CTX : BN_CTX_new() returned NULL");
|
||||
}
|
||||
|
||||
~CAutoBN_CTX()
|
||||
{
|
||||
if (pctx != NULL)
|
||||
BN_CTX_free(pctx);
|
||||
}
|
||||
|
||||
operator BN_CTX*() { return pctx; }
|
||||
BN_CTX& operator*() { return *pctx; }
|
||||
BN_CTX** operator&() { return &pctx; }
|
||||
bool operator!() { return (pctx == NULL); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CBigNum : public BIGNUM
|
||||
{
|
||||
public:
|
||||
CBigNum()
|
||||
{
|
||||
BN_init(this);
|
||||
}
|
||||
|
||||
CBigNum(const CBigNum& b)
|
||||
{
|
||||
BN_init(this);
|
||||
if (!BN_copy(this, &b))
|
||||
{
|
||||
BN_clear_free(this);
|
||||
throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed");
|
||||
}
|
||||
}
|
||||
|
||||
CBigNum& operator=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_copy(this, &b))
|
||||
throw bignum_error("CBigNum::operator= : BN_copy failed");
|
||||
return (*this);
|
||||
}
|
||||
|
||||
~CBigNum()
|
||||
{
|
||||
BN_clear_free(this);
|
||||
}
|
||||
|
||||
CBigNum(char n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(short n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(int n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(long n) { BN_init(this); if (n >= 0) setulong(n); else setint64(n); }
|
||||
CBigNum(int64 n) { BN_init(this); setint64(n); }
|
||||
CBigNum(unsigned char n) { BN_init(this); setulong(n); }
|
||||
CBigNum(unsigned short n) { BN_init(this); setulong(n); }
|
||||
CBigNum(unsigned int n) { BN_init(this); setulong(n); }
|
||||
CBigNum(unsigned long n) { BN_init(this); setulong(n); }
|
||||
CBigNum(uint64 n) { BN_init(this); setuint64(n); }
|
||||
explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); }
|
||||
|
||||
explicit CBigNum(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
BN_init(this);
|
||||
setvch(vch);
|
||||
}
|
||||
|
||||
void setulong(unsigned long n)
|
||||
{
|
||||
if (!BN_set_word(this, n))
|
||||
throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed");
|
||||
}
|
||||
|
||||
unsigned long getulong() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
unsigned int getuint() const
|
||||
{
|
||||
return BN_get_word(this);
|
||||
}
|
||||
|
||||
int getint() const
|
||||
{
|
||||
unsigned long n = BN_get_word(this);
|
||||
if (!BN_is_negative(this))
|
||||
return (n > INT_MAX ? INT_MAX : n);
|
||||
else
|
||||
return (n > INT_MAX ? INT_MIN : -(int)n);
|
||||
}
|
||||
|
||||
void setint64(int64 n)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fNegative = false;
|
||||
if (n < (int64)0)
|
||||
{
|
||||
n = -n;
|
||||
fNegative = true;
|
||||
}
|
||||
bool fLeadingZeroes = true;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char c = (n >> 56) & 0xff;
|
||||
n <<= 8;
|
||||
if (fLeadingZeroes)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
if (c & 0x80)
|
||||
*p++ = (fNegative ? 0x80 : 0);
|
||||
else if (fNegative)
|
||||
c |= 0x80;
|
||||
fLeadingZeroes = false;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
unsigned int nSize = p - (pch + 4);
|
||||
pch[0] = (nSize >> 24) & 0xff;
|
||||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
}
|
||||
|
||||
void setuint64(uint64 n)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fLeadingZeroes = true;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
unsigned char c = (n >> 56) & 0xff;
|
||||
n <<= 8;
|
||||
if (fLeadingZeroes)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
if (c & 0x80)
|
||||
*p++ = 0;
|
||||
fLeadingZeroes = false;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
unsigned int nSize = p - (pch + 4);
|
||||
pch[0] = (nSize >> 24) & 0xff;
|
||||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
}
|
||||
|
||||
void setuint256(uint256 n)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fLeadingZeroes = true;
|
||||
unsigned char* pbegin = (unsigned char*)&n;
|
||||
unsigned char* psrc = pbegin + sizeof(n);
|
||||
while (psrc != pbegin)
|
||||
{
|
||||
unsigned char c = *(--psrc);
|
||||
if (fLeadingZeroes)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
if (c & 0x80)
|
||||
*p++ = 0;
|
||||
fLeadingZeroes = false;
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
unsigned int nSize = p - (pch + 4);
|
||||
pch[0] = (nSize >> 24) & 0xff;
|
||||
pch[1] = (nSize >> 16) & 0xff;
|
||||
pch[2] = (nSize >> 8) & 0xff;
|
||||
pch[3] = (nSize >> 0) & 0xff;
|
||||
BN_mpi2bn(pch, p - pch, this);
|
||||
}
|
||||
|
||||
uint256 getuint256()
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
if (nSize < 4)
|
||||
return 0;
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
if (vch.size() > 4)
|
||||
vch[4] &= 0x7f;
|
||||
uint256 n = 0;
|
||||
for (int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
|
||||
((unsigned char*)&n)[i] = vch[j];
|
||||
return n;
|
||||
}
|
||||
|
||||
void setvch(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
std::vector<unsigned char> vch2(vch.size() + 4);
|
||||
unsigned int nSize = vch.size();
|
||||
vch2[0] = (nSize >> 24) & 0xff;
|
||||
vch2[1] = (nSize >> 16) & 0xff;
|
||||
vch2[2] = (nSize >> 8) & 0xff;
|
||||
vch2[3] = (nSize >> 0) & 0xff;
|
||||
reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
|
||||
BN_mpi2bn(&vch2[0], vch2.size(), this);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> getvch() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
if (nSize < 4)
|
||||
return std::vector<unsigned char>();
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
vch.erase(vch.begin(), vch.begin() + 4);
|
||||
reverse(vch.begin(), vch.end());
|
||||
return vch;
|
||||
}
|
||||
|
||||
CBigNum& SetCompact(unsigned int nCompact)
|
||||
{
|
||||
unsigned int nSize = nCompact >> 24;
|
||||
std::vector<unsigned char> vch(4 + nSize);
|
||||
vch[3] = nSize;
|
||||
if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
|
||||
if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
|
||||
if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
|
||||
BN_mpi2bn(&vch[0], vch.size(), this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int GetCompact() const
|
||||
{
|
||||
unsigned int nSize = BN_bn2mpi(this, NULL);
|
||||
std::vector<unsigned char> vch(nSize);
|
||||
nSize -= 4;
|
||||
BN_bn2mpi(this, &vch[0]);
|
||||
unsigned int nCompact = nSize << 24;
|
||||
if (nSize >= 1) nCompact |= (vch[4] << 16);
|
||||
if (nSize >= 2) nCompact |= (vch[5] << 8);
|
||||
if (nSize >= 3) nCompact |= (vch[6] << 0);
|
||||
return nCompact;
|
||||
}
|
||||
|
||||
void SetHex(const std::string& str)
|
||||
{
|
||||
// skip 0x
|
||||
const char* psz = str.c_str();
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
bool fNegative = false;
|
||||
if (*psz == '-')
|
||||
{
|
||||
fNegative = true;
|
||||
psz++;
|
||||
}
|
||||
if (psz[0] == '0' && tolower(psz[1]) == 'x')
|
||||
psz += 2;
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// hex string to bignum
|
||||
static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
|
||||
*this = 0;
|
||||
while (isxdigit(*psz))
|
||||
{
|
||||
*this <<= 4;
|
||||
int n = phexdigit[*psz++];
|
||||
*this += n;
|
||||
}
|
||||
if (fNegative)
|
||||
*this = 0 - *this;
|
||||
}
|
||||
|
||||
std::string ToString(int nBase=10) const
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum bnBase = nBase;
|
||||
CBigNum bn0 = 0;
|
||||
string str;
|
||||
CBigNum bn = *this;
|
||||
BN_set_negative(&bn, false);
|
||||
CBigNum dv;
|
||||
CBigNum rem;
|
||||
if (BN_cmp(&bn, &bn0) == 0)
|
||||
return "0";
|
||||
while (BN_cmp(&bn, &bn0) > 0)
|
||||
{
|
||||
if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
|
||||
throw bignum_error("CBigNum::ToString() : BN_div failed");
|
||||
bn = dv;
|
||||
unsigned int c = rem.getulong();
|
||||
str += "0123456789abcdef"[c];
|
||||
}
|
||||
if (BN_is_negative(this))
|
||||
str += "-";
|
||||
reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string GetHex() const
|
||||
{
|
||||
return ToString(16);
|
||||
}
|
||||
|
||||
unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
return ::GetSerializeSize(getvch(), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
::Serialize(s, getvch(), nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType=0, int nVersion=VERSION)
|
||||
{
|
||||
vector<unsigned char> vch;
|
||||
::Unserialize(s, vch, nType, nVersion);
|
||||
setvch(vch);
|
||||
}
|
||||
|
||||
|
||||
bool operator!() const
|
||||
{
|
||||
return BN_is_zero(this);
|
||||
}
|
||||
|
||||
CBigNum& operator+=(const CBigNum& b)
|
||||
{
|
||||
if (!BN_add(this, this, &b))
|
||||
throw bignum_error("CBigNum::operator+= : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator-=(const CBigNum& b)
|
||||
{
|
||||
*this = *this - b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator*=(const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
if (!BN_mul(this, this, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator*= : BN_mul failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator/=(const CBigNum& b)
|
||||
{
|
||||
*this = *this / b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator%=(const CBigNum& b)
|
||||
{
|
||||
*this = *this % b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator<<=(unsigned int shift)
|
||||
{
|
||||
if (!BN_lshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator<<= : BN_lshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBigNum& operator>>=(unsigned int shift)
|
||||
{
|
||||
// Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number
|
||||
// if built on ubuntu 9.04 or 9.10, probably depends on version of openssl
|
||||
CBigNum a = 1;
|
||||
a <<= shift;
|
||||
if (BN_cmp(&a, this) > 0)
|
||||
{
|
||||
*this = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (!BN_rshift(this, this, shift))
|
||||
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
CBigNum& operator++()
|
||||
{
|
||||
// prefix operator
|
||||
if (!BN_add(this, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator++ : BN_add failed");
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
++(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CBigNum& operator--()
|
||||
{
|
||||
// prefix operator
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, this, BN_value_one()))
|
||||
throw bignum_error("CBigNum::operator-- : BN_sub failed");
|
||||
*this = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const CBigNum operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
const CBigNum ret = *this;
|
||||
--(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator/(const CBigNum& a, const CBigNum& b);
|
||||
friend inline const CBigNum operator%(const CBigNum& a, const CBigNum& b);
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline const CBigNum operator+(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_add(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator+ : BN_add failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator-(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_sub(&r, &a, &b))
|
||||
throw bignum_error("CBigNum::operator- : BN_sub failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator-(const CBigNum& a)
|
||||
{
|
||||
CBigNum r(a);
|
||||
BN_set_negative(&r, !BN_is_negative(&r));
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator*(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mul(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator* : BN_mul failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator/(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_div(&r, NULL, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator/ : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator%(const CBigNum& a, const CBigNum& b)
|
||||
{
|
||||
CAutoBN_CTX pctx;
|
||||
CBigNum r;
|
||||
if (!BN_mod(&r, &a, &b, pctx))
|
||||
throw bignum_error("CBigNum::operator% : BN_div failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator<<(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r;
|
||||
if (!BN_lshift(&r, &a, shift))
|
||||
throw bignum_error("CBigNum:operator<< : BN_lshift failed");
|
||||
return r;
|
||||
}
|
||||
|
||||
inline const CBigNum operator>>(const CBigNum& a, unsigned int shift)
|
||||
{
|
||||
CBigNum r = a;
|
||||
r >>= shift;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) == 0); }
|
||||
inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) != 0); }
|
||||
inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) <= 0); }
|
||||
inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) >= 0); }
|
||||
inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) < 0); }
|
||||
inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) > 0); }
|
||||
67
src/cryptopp/License.txt
Normal file
67
src/cryptopp/License.txt
Normal file
@@ -0,0 +1,67 @@
|
||||
Compilation Copyright (c) 1995-2009 by Wei Dai. All rights reserved.
|
||||
This copyright applies only to this software distribution package
|
||||
as a compilation, and does not imply a copyright on any particular
|
||||
file in the package.
|
||||
|
||||
The following files are copyrighted by their respective original authors,
|
||||
and their use is subject to additional licenses included in these files.
|
||||
|
||||
mars.cpp - Copyright 1998 Brian Gladman.
|
||||
|
||||
All other files in this compilation are placed in the public domain by
|
||||
Wei Dai and other contributors.
|
||||
|
||||
I would like to thank the following authors for placing their works into
|
||||
the public domain:
|
||||
|
||||
Joan Daemen - 3way.cpp
|
||||
Leonard Janke - cast.cpp, seal.cpp
|
||||
Steve Reid - cast.cpp
|
||||
Phil Karn - des.cpp
|
||||
Andrew M. Kuchling - md2.cpp, md4.cpp
|
||||
Colin Plumb - md5.cpp
|
||||
Seal Woods - rc6.cpp
|
||||
Chris Morgan - rijndael.cpp
|
||||
Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp
|
||||
Richard De Moliner - safer.cpp
|
||||
Matthew Skala - twofish.cpp
|
||||
Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp
|
||||
|
||||
Permission to use, copy, modify, and distribute this compilation for
|
||||
any purpose, including commercial applications, is hereby granted
|
||||
without fee, subject to the following restrictions:
|
||||
|
||||
1. Any copy or modification of this compilation in any form, except
|
||||
in object code form as part of an application software, must include
|
||||
the above copyright notice and this license.
|
||||
|
||||
2. Users of this software agree that any modification or extension
|
||||
they provide to Wei Dai will be considered public domain and not
|
||||
copyrighted unless it includes an explicit copyright notice.
|
||||
|
||||
3. Wei Dai makes no warranty or representation that the operation of the
|
||||
software in this compilation will be error-free, and Wei Dai is under no
|
||||
obligation to provide any services, by way of maintenance, update, or
|
||||
otherwise. THE SOFTWARE AND ANY DOCUMENTATION ARE PROVIDED "AS IS"
|
||||
WITHOUT EXPRESS OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL WEI DAI OR ANY OTHER CONTRIBUTOR BE LIABLE FOR
|
||||
DIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
4. Users will not use Wei Dai or any other contributor's name in any
|
||||
publicity or advertising, without prior written consent in each case.
|
||||
|
||||
5. Export of this software from the United States may require a
|
||||
specific license from the United States Government. It is the
|
||||
responsibility of any person or organization contemplating export
|
||||
to obtain such a license before exporting.
|
||||
|
||||
6. Certain parts of this software may be protected by patents. It
|
||||
is the users' responsibility to obtain the appropriate
|
||||
licenses before using those parts.
|
||||
|
||||
If this compilation is used in object code form in an application
|
||||
software, acknowledgement of the author is not required but would be
|
||||
appreciated. The contribution of any useful modifications or extensions
|
||||
to Wei Dai is not required but would also be appreciated.
|
||||
429
src/cryptopp/Readme.txt
Normal file
429
src/cryptopp/Readme.txt
Normal file
@@ -0,0 +1,429 @@
|
||||
Crypto++: a C++ Class Library of Cryptographic Schemes
|
||||
Version 5.6.0 (3/15/2009)
|
||||
|
||||
Crypto++ Library is a free C++ class library of cryptographic schemes.
|
||||
Currently the library contains the following algorithms:
|
||||
|
||||
algorithm type name
|
||||
|
||||
authenticated encryption schemes GCM, CCM, EAX
|
||||
|
||||
high speed stream ciphers Panama, Sosemanuk, Salsa20, XSalsa20
|
||||
|
||||
AES and AES candidates AES (Rijndael), RC6, MARS, Twofish, Serpent,
|
||||
CAST-256
|
||||
|
||||
IDEA, Triple-DES (DES-EDE2 and DES-EDE3),
|
||||
other block ciphers Camellia, SEED, RC5, Blowfish, TEA, XTEA,
|
||||
Skipjack, SHACAL-2
|
||||
|
||||
block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS),
|
||||
CFB, OFB, counter mode (CTR)
|
||||
|
||||
message authentication codes VMAC, HMAC, CMAC, CBC-MAC, DMAC,
|
||||
Two-Track-MAC
|
||||
|
||||
SHA-1, SHA-2 (SHA-224, SHA-256, SHA-384, and
|
||||
hash functions SHA-512), Tiger, WHIRLPOOL, RIPEMD-128,
|
||||
RIPEMD-256, RIPEMD-160, RIPEMD-320
|
||||
|
||||
RSA, DSA, ElGamal, Nyberg-Rueppel (NR),
|
||||
public-key cryptography Rabin, Rabin-Williams (RW), LUC, LUCELG,
|
||||
DLIES (variants of DHAES), ESIGN
|
||||
|
||||
padding schemes for public-key PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363
|
||||
systems EMSA2 and EMSA5
|
||||
|
||||
Diffie-Hellman (DH), Unified Diffie-Hellman
|
||||
key agreement schemes (DH2), Menezes-Qu-Vanstone (MQV), LUCDIF,
|
||||
XTR-DH
|
||||
|
||||
elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV
|
||||
|
||||
insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL
|
||||
algorithms retained for backwards 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2,
|
||||
compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square
|
||||
value
|
||||
|
||||
Other features include:
|
||||
|
||||
* pseudo random number generators (PRNG): ANSI X9.17 appendix C, RandomPool
|
||||
* password based key derivation functions: PBKDF1 and PBKDF2 from PKCS #5,
|
||||
PBKDF from PKCS #12 appendix B
|
||||
* Shamir's secret sharing scheme and Rabin's information dispersal algorithm
|
||||
(IDA)
|
||||
* fast multi-precision integer (bignum) and polynomial operations
|
||||
* finite field arithmetics, including GF(p) and GF(2^n)
|
||||
* prime number generation and verification
|
||||
* useful non-cryptographic algorithms
|
||||
+ DEFLATE (RFC 1951) compression/decompression with gzip (RFC 1952) and
|
||||
zlib (RFC 1950) format support
|
||||
+ hex, base-32, and base-64 coding/decoding
|
||||
+ 32-bit CRC and Adler32 checksum
|
||||
* class wrappers for these operating system features (optional):
|
||||
+ high resolution timers on Windows, Unix, and Mac OS
|
||||
+ Berkeley and Windows style sockets
|
||||
+ Windows named pipes
|
||||
+ /dev/random, /dev/urandom, /dev/srandom
|
||||
+ Microsoft's CryptGenRandom on Windows
|
||||
* A high level interface for most of the above, using a filter/pipeline
|
||||
metaphor
|
||||
* benchmarks and validation testing
|
||||
* x86, x86-64 (x64), MMX, and SSE2 assembly code for the most commonly used
|
||||
algorithms, with run-time CPU feature detection and code selection
|
||||
* some versions are available in FIPS 140-2 validated form
|
||||
|
||||
You are welcome to use it for any purpose without paying me, but see
|
||||
License.txt for the fine print.
|
||||
|
||||
The following compilers are supported for this release. Please visit
|
||||
http://www.cryptopp.com the most up to date build instructions and porting notes.
|
||||
|
||||
* MSVC 6.0 - 2008
|
||||
* GCC 3.3 - 4.3
|
||||
* C++Builder 2009
|
||||
* Intel C++ Compiler 9 - 11
|
||||
* Sun Studio 12 (CC 5.9)
|
||||
|
||||
*** Important Usage Notes ***
|
||||
|
||||
1. If a constructor for A takes a pointer to an object B (except primitive
|
||||
types such as int and char), then A owns B and will delete B at A's
|
||||
destruction. If a constructor for A takes a reference to an object B,
|
||||
then the caller retains ownership of B and should not destroy it until
|
||||
A no longer needs it.
|
||||
|
||||
2. Crypto++ is thread safe at the class level. This means you can use
|
||||
Crypto++ safely in a multithreaded application, but you must provide
|
||||
synchronization when multiple threads access a common Crypto++ object.
|
||||
|
||||
*** MSVC-Specific Information ***
|
||||
|
||||
On Windows, Crypto++ can be compiled into 3 forms: a static library
|
||||
including all algorithms, a DLL with only FIPS Approved algorithms, and
|
||||
a static library with only algorithms not in the DLL.
|
||||
(FIPS Approved means Approved according to the FIPS 140-2 standard.)
|
||||
The DLL may be used by itself, or it may be used together with the second
|
||||
form of the static library. MSVC project files are included to build
|
||||
all three forms, and sample applications using each of the three forms
|
||||
are also included.
|
||||
|
||||
To compile Crypto++ with MSVC, open the "cryptest.dsw" (for MSVC 6 and MSVC .NET
|
||||
2003) or "cryptest.sln" (for MSVC .NET 2005) workspace file and build one or
|
||||
more of the following projects:
|
||||
|
||||
cryptdll - This builds the DLL. Please note that if you wish to use Crypto++
|
||||
as a FIPS validated module, you must use a pre-built DLL that has undergone
|
||||
the FIPS validation process instead of building your own.
|
||||
dlltest - This builds a sample application that only uses the DLL.
|
||||
cryptest Non-DLL-Import Configuration - This builds the full static library
|
||||
along with a full test driver.
|
||||
cryptest DLL-Import Configuration - This builds a static library containing
|
||||
only algorithms not in the DLL, along with a full test driver that uses
|
||||
both the DLL and the static library.
|
||||
|
||||
To use the Crypto++ DLL in your application, #include "dll.h" before including
|
||||
any other Crypto++ header files, and place the DLL in the same directory as
|
||||
your .exe file. dll.h includes the line #pragma comment(lib, "cryptopp")
|
||||
so you don't have to explicitly list the import library in your project
|
||||
settings. To use a static library form of Crypto++, specify it as
|
||||
an additional library to link with in your project settings.
|
||||
In either case you should check the compiler options to
|
||||
make sure that the library and your application are using the same C++
|
||||
run-time libraries and calling conventions.
|
||||
|
||||
*** DLL Memory Management ***
|
||||
|
||||
Because it's possible for the Crypto++ DLL to delete objects allocated
|
||||
by the calling application, they must use the same C++ memory heap. Three
|
||||
methods are provided to achieve this.
|
||||
1. The calling application can tell Crypto++ what heap to use. This method
|
||||
is required when the calling application uses a non-standard heap.
|
||||
2. Crypto++ can tell the calling application what heap to use. This method
|
||||
is required when the calling application uses a statically linked C++ Run
|
||||
Time Library. (Method 1 does not work in this case because the Crypto++ DLL
|
||||
is initialized before the calling application's heap is initialized.)
|
||||
3. Crypto++ can automatically use the heap provided by the calling application's
|
||||
dynamically linked C++ Run Time Library. The calling application must
|
||||
make sure that the dynamically linked C++ Run Time Library is initialized
|
||||
before Crypto++ is loaded. (At this time it is not clear if it is possible
|
||||
to control the order in which DLLs are initialized on Windows 9x machines,
|
||||
so it might be best to avoid using this method.)
|
||||
|
||||
When Crypto++ attaches to a new process, it searches all modules loaded
|
||||
into the process space for exported functions "GetNewAndDeleteForCryptoPP"
|
||||
and "SetNewAndDeleteFromCryptoPP". If one of these functions is found,
|
||||
Crypto++ uses methods 1 or 2, respectively, by calling the function.
|
||||
Otherwise, method 3 is used.
|
||||
|
||||
*** GCC-Specific Information ***
|
||||
|
||||
A makefile is included for you to compile Crypto++ with GCC. Make sure
|
||||
you are using GNU Make and GNU ld. The make process will produce two files,
|
||||
libcryptopp.a and cryptest.exe. Run "cryptest.exe v" for the validation
|
||||
suite.
|
||||
|
||||
*** Documentation and Support ***
|
||||
|
||||
Crypto++ is documented through inline comments in header files, which are
|
||||
processed through Doxygen to produce an HTML reference manual. You can find
|
||||
a link to the manual from http://www.cryptopp.com. Also at that site is
|
||||
the Crypto++ FAQ, which you should browse through before attempting to
|
||||
use this library, because it will likely answer many of questions that
|
||||
may come up.
|
||||
|
||||
If you run into any problems, please try the Crypto++ mailing list.
|
||||
The subscription information and the list archive are available on
|
||||
http://www.cryptopp.com. You can also email me directly by visiting
|
||||
http://www.weidai.com, but you will probably get a faster response through
|
||||
the mailing list.
|
||||
|
||||
*** History ***
|
||||
|
||||
1.0 - First public release. Withdrawn at the request of RSA DSI.
|
||||
- included Blowfish, BBS, DES, DH, Diamond, DSA, ElGamal, IDEA,
|
||||
MD5, RC4, RC5, RSA, SHA, WAKE, secret sharing, DEFLATE compression
|
||||
- had a serious bug in the RSA key generation code.
|
||||
|
||||
1.1 - Removed RSA, RC4, RC5
|
||||
- Disabled calls to RSAREF's non-public functions
|
||||
- Minor bugs fixed
|
||||
|
||||
2.0 - a completely new, faster multiprecision integer class
|
||||
- added MD5-MAC, HAVAL, 3-WAY, TEA, SAFER, LUC, Rabin, BlumGoldwasser,
|
||||
elliptic curve algorithms
|
||||
- added the Lucas strong probable primality test
|
||||
- ElGamal encryption and signature schemes modified to avoid weaknesses
|
||||
- Diamond changed to Diamond2 because of key schedule weakness
|
||||
- fixed bug in WAKE key setup
|
||||
- SHS class renamed to SHA
|
||||
- lots of miscellaneous optimizations
|
||||
|
||||
2.1 - added Tiger, HMAC, GOST, RIPE-MD160, LUCELG, LUCDIF, XOR-MAC,
|
||||
OAEP, PSSR, SHARK
|
||||
- added precomputation to DH, ElGamal, DSA, and elliptic curve algorithms
|
||||
- added back RC5 and a new RSA
|
||||
- optimizations in elliptic curves over GF(p)
|
||||
- changed Rabin to use OAEP and PSSR
|
||||
- changed many classes to allow copy constructors to work correctly
|
||||
- improved exception generation and handling
|
||||
|
||||
2.2 - added SEAL, CAST-128, Square
|
||||
- fixed bug in HAVAL (padding problem)
|
||||
- fixed bug in triple-DES (decryption order was reversed)
|
||||
- fixed bug in RC5 (couldn't handle key length not a multiple of 4)
|
||||
- changed HMAC to conform to RFC-2104 (which is not compatible
|
||||
with the original HMAC)
|
||||
- changed secret sharing and information dispersal to use GF(2^32)
|
||||
instead of GF(65521)
|
||||
- removed zero knowledge prover/verifier for graph isomorphism
|
||||
- removed several utility classes in favor of the C++ standard library
|
||||
|
||||
2.3 - ported to EGCS
|
||||
- fixed incomplete workaround of min/max conflict in MSVC
|
||||
|
||||
3.0 - placed all names into the "CryptoPP" namespace
|
||||
- added MD2, RC2, RC6, MARS, RW, DH2, MQV, ECDHC, CBC-CTS
|
||||
- added abstract base classes PK_SimpleKeyAgreementDomain and
|
||||
PK_AuthenticatedKeyAgreementDomain
|
||||
- changed DH and LUCDIF to implement the PK_SimpleKeyAgreementDomain
|
||||
interface and to perform domain parameter and key validation
|
||||
- changed interfaces of PK_Signer and PK_Verifier to sign and verify
|
||||
messages instead of message digests
|
||||
- changed OAEP to conform to PKCS#1 v2.0
|
||||
- changed benchmark code to produce HTML tables as output
|
||||
- changed PSSR to track IEEE P1363a
|
||||
- renamed ElGamalSignature to NR and changed it to track IEEE P1363
|
||||
- renamed ECKEP to ECMQVC and changed it to track IEEE P1363
|
||||
- renamed several other classes for clarity
|
||||
- removed support for calling RSAREF
|
||||
- removed option to compile old SHA (SHA-0)
|
||||
- removed option not to throw exceptions
|
||||
|
||||
3.1 - added ARC4, Rijndael, Twofish, Serpent, CBC-MAC, DMAC
|
||||
- added interface for querying supported key lengths of symmetric ciphers
|
||||
and MACs
|
||||
- added sample code for RSA signature and verification
|
||||
- changed CBC-CTS to be compatible with RFC 2040
|
||||
- updated SEAL to version 3.0 of the cipher specification
|
||||
- optimized multiprecision squaring and elliptic curves over GF(p)
|
||||
- fixed bug in MARS key setup
|
||||
- fixed bug with attaching objects to Deflator
|
||||
|
||||
3.2 - added DES-XEX3, ECDSA, DefaultEncryptorWithMAC
|
||||
- renamed DES-EDE to DES-EDE2 and TripleDES to DES-EDE3
|
||||
- optimized ARC4
|
||||
- generalized DSA to allow keys longer than 1024 bits
|
||||
- fixed bugs in GF2N and ModularArithmetic that can cause calculation errors
|
||||
- fixed crashing bug in Inflator when given invalid inputs
|
||||
- fixed endian bug in Serpent
|
||||
- fixed padding bug in Tiger
|
||||
|
||||
4.0 - added Skipjack, CAST-256, Panama, SHA-2 (SHA-256, SHA-384, and SHA-512),
|
||||
and XTR-DH
|
||||
- added a faster variant of Rabin's Information Dispersal Algorithm (IDA)
|
||||
- added class wrappers for these operating system features:
|
||||
- high resolution timers on Windows, Unix, and MacOS
|
||||
- Berkeley and Windows style sockets
|
||||
- Windows named pipes
|
||||
- /dev/random and /dev/urandom on Linux and FreeBSD
|
||||
- Microsoft's CryptGenRandom on Windows
|
||||
- added support for SEC 1 elliptic curve key format and compressed points
|
||||
- added support for X.509 public key format (subjectPublicKeyInfo) for
|
||||
RSA, DSA, and elliptic curve schemes
|
||||
- added support for DER and OpenPGP signature format for DSA
|
||||
- added support for ZLIB compressed data format (RFC 1950)
|
||||
- changed elliptic curve encryption to use ECIES (as defined in SEC 1)
|
||||
- changed MARS key schedule to reflect the latest specification
|
||||
- changed BufferedTransformation interface to support multiple channels
|
||||
and messages
|
||||
- changed CAST and SHA-1 implementations to use public domain source code
|
||||
- fixed bug in StringSource
|
||||
- optmized multi-precision integer code for better performance
|
||||
|
||||
4.1 - added more support for the recommended elliptic curve parameters in SEC 2
|
||||
- added Panama MAC, MARC4
|
||||
- added IV stealing feature to CTS mode
|
||||
- added support for PKCS #8 private key format for RSA, DSA, and elliptic
|
||||
curve schemes
|
||||
- changed Deflate, MD5, Rijndael, and Twofish to use public domain code
|
||||
- fixed a bug with flushing compressed streams
|
||||
- fixed a bug with decompressing stored blocks
|
||||
- fixed a bug with EC point decompression using non-trinomial basis
|
||||
- fixed a bug in NetworkSource::GeneralPump()
|
||||
- fixed a performance issue with EC over GF(p) decryption
|
||||
- fixed syntax to allow GCC to compile without -fpermissive
|
||||
- relaxed some restrictions in the license
|
||||
|
||||
4.2 - added support for longer HMAC keys
|
||||
- added MD4 (which is not secure so use for compatibility purposes only)
|
||||
- added compatibility fixes/workarounds for STLport 4.5, GCC 3.0.2,
|
||||
and MSVC 7.0
|
||||
- changed MD2 to use public domain code
|
||||
- fixed a bug with decompressing multiple messages with the same object
|
||||
- fixed a bug in CBC-MAC with MACing multiple messages with the same object
|
||||
- fixed a bug in RC5 and RC6 with zero-length keys
|
||||
- fixed a bug in Adler32 where incorrect checksum may be generated
|
||||
|
||||
5.0 - added ESIGN, DLIES, WAKE-OFB, PBKDF1 and PBKDF2 from PKCS #5
|
||||
- added key validation for encryption and signature public/private keys
|
||||
- renamed StreamCipher interface to SymmetricCipher, which is now implemented
|
||||
by both stream ciphers and block cipher modes including ECB and CBC
|
||||
- added keying interfaces to support resetting of keys and IVs without
|
||||
having to destroy and recreate objects
|
||||
- changed filter interface to support non-blocking input/output
|
||||
- changed SocketSource and SocketSink to use overlapped I/O on Microsoft Windows
|
||||
- grouped related classes inside structs to help templates, for example
|
||||
AESEncryption and AESDecryption are now AES::Encryption and AES::Decryption
|
||||
- where possible, typedefs have been added to improve backwards
|
||||
compatibility when the CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY macro is defined
|
||||
- changed Serpent, HAVAL and IDEA to use public domain code
|
||||
- implemented SSE2 optimizations for Integer operations
|
||||
- fixed a bug in HMAC::TruncatedFinal()
|
||||
- fixed SKIPJACK byte ordering following NIST clarification dated 5/9/02
|
||||
|
||||
5.01 - added known answer test for X9.17 RNG in FIPS 140 power-up self test
|
||||
- submitted to NIST/CSE, but not publicly released
|
||||
|
||||
5.02 - changed EDC test to MAC integrity check using HMAC/SHA1
|
||||
- improved performance of integrity check
|
||||
- added blinding to defend against RSA timing attack
|
||||
|
||||
5.03 - created DLL version of Crypto++ for FIPS 140-2 validation
|
||||
- fixed vulnerabilities in GetNextIV for CTR and OFB modes
|
||||
|
||||
5.0.4 - Removed DES, SHA-256, SHA-384, SHA-512 from DLL
|
||||
|
||||
5.1 - added PSS padding and changed PSSR to track IEEE P1363a draft standard
|
||||
- added blinding for RSA and Rabin to defend against timing attacks
|
||||
on decryption operations
|
||||
- changed signing and decryption APIs to support the above
|
||||
- changed WaitObjectContainer to allow waiting for more than 64
|
||||
objects at a time on Win32 platforms
|
||||
- fixed a bug in CBC and ECB modes with processing non-aligned data
|
||||
- fixed standard conformance bugs in DLIES (DHAES mode) and RW/EMSA2
|
||||
signature scheme (these fixes are not backwards compatible)
|
||||
- fixed a number of compiler warnings, minor bugs, and portability problems
|
||||
- removed Sapphire
|
||||
|
||||
5.2 - merged in changes for 5.01 - 5.0.4
|
||||
- added support for using encoding parameters and key derivation parameters
|
||||
with public key encryption (implemented by OAEP and DL/ECIES)
|
||||
- added Camellia, SHACAL-2, Two-Track-MAC, Whirlpool, RIPEMD-320,
|
||||
RIPEMD-128, RIPEMD-256, Base-32 coding, FIPS variant of CFB mode
|
||||
- added ThreadUserTimer for timing thread CPU usage
|
||||
- added option for password-based key derivation functions
|
||||
to iterate until a mimimum elapsed thread CPU time is reached
|
||||
- added option (on by default) for DEFLATE compression to detect
|
||||
uncompressible files and process them more quickly
|
||||
- improved compatibility and performance on 64-bit platforms,
|
||||
including Alpha, IA-64, x86-64, PPC64, Sparc64, and MIPS64
|
||||
- fixed ONE_AND_ZEROS_PADDING to use 0x80 instead 0x01 as padding.
|
||||
- fixed encoding/decoding of PKCS #8 privateKeyInfo to properly
|
||||
handle optional attributes
|
||||
|
||||
5.2.1 - fixed bug in the "dlltest" DLL testing program
|
||||
- fixed compiling with STLport using VC .NET
|
||||
- fixed compiling with -fPIC using GCC
|
||||
- fixed compiling with -msse2 on systems without memalign()
|
||||
- fixed inability to instantiate PanamaMAC
|
||||
- fixed problems with inline documentation
|
||||
|
||||
5.2.2 - added SHA-224
|
||||
- put SHA-256, SHA-384, SHA-512, RSASSA-PSS into DLL
|
||||
|
||||
5.2.3 - fixed issues with FIPS algorithm test vectors
|
||||
- put RSASSA-ISO into DLL
|
||||
|
||||
5.3 - ported to MSVC 2005 with support for x86-64
|
||||
- added defense against AES timing attacks, and more AES test vectors
|
||||
- changed StaticAlgorithmName() of Rijndael to "AES", CTR to "CTR"
|
||||
|
||||
5.4 - added Salsa20
|
||||
- updated Whirlpool to version 3.0
|
||||
- ported to GCC 4.1, Sun C++ 5.8, and Borland C++Builder 2006
|
||||
|
||||
5.5 - added VMAC and Sosemanuk (with x86-64 and SSE2 assembly)
|
||||
- improved speed of integer arithmetic, AES, SHA-512, Tiger, Salsa20,
|
||||
Whirlpool, and PANAMA cipher using assembly (x86-64, MMX, SSE2)
|
||||
- optimized Camellia and added defense against timing attacks
|
||||
- updated benchmarks code to show cycles per byte and to time key/IV setup
|
||||
- started using OpenMP for increased multi-core speed
|
||||
- enabled GCC optimization flags by default in GNUmakefile
|
||||
- added blinding and computational error checking for RW signing
|
||||
- changed RandomPool, X917RNG, GetNextIV, DSA/NR/ECDSA/ECNR to reduce
|
||||
the risk of reusing random numbers and IVs after virtual machine state
|
||||
rollback
|
||||
- changed default FIPS mode RNG from AutoSeededX917RNG<DES_EDE3> to
|
||||
AutoSeededX917RNG<AES>
|
||||
- fixed PANAMA cipher interface to accept 256-bit key and 256-bit IV
|
||||
- moved MD2, MD4, MD5, PanamaHash, ARC4, WAKE_CFB into the namespace "Weak"
|
||||
- removed HAVAL, MD5-MAC, XMAC
|
||||
|
||||
5.5.1 - fixed VMAC validation failure on 32-bit big-endian machines
|
||||
|
||||
5.5.2 - ported x64 assembly language code for AES, Salsa20, Sosemanuk, and Panama
|
||||
to MSVC 2005 (using MASM since MSVC doesn't support inline assembly on x64)
|
||||
- fixed Salsa20 initialization crash on non-SSE2 machines
|
||||
- fixed Whirlpool crash on Pentium 2 machines
|
||||
- fixed possible branch prediction analysis (BPA) vulnerability in
|
||||
MontgomeryReduce(), which may affect security of RSA, RW, LUC
|
||||
- fixed link error with MSVC 2003 when using "debug DLL" form of runtime library
|
||||
- fixed crash in SSE2_Add on P4 machines when compiled with
|
||||
MSVC 6.0 SP5 with Processor Pack
|
||||
- ported to MSVC 2008, GCC 4.2, Sun CC 5.9, Intel C++ Compiler 10.0,
|
||||
and Borland C++Builder 2007
|
||||
|
||||
5.6 - added AuthenticatedSymmetricCipher interface class and Filter wrappers
|
||||
- added CCM, GCM (with SSE2 assembly), EAX, CMAC, XSalsa20, and SEED
|
||||
- added support for variable length IVs
|
||||
- improved AES and SHA-256 speed on x86 and x64
|
||||
- fixed incorrect VMAC computation on message lengths
|
||||
that are >64 mod 128 (x86 assembly version is not affected)
|
||||
- fixed compiler error in vmac.cpp on x86 with GCC -fPIC
|
||||
- fixed run-time validation error on x86-64 with GCC 4.3.2 -O2
|
||||
- fixed HashFilter bug when putMessage=true
|
||||
- removed WORD64_AVAILABLE; compiler support for 64-bit int is now required
|
||||
- ported to GCC 4.3, C++Builder 2009, Sun CC 5.10, Intel C++ Compiler 11
|
||||
|
||||
Written by Wei Dai
|
||||
462
src/cryptopp/config.h
Normal file
462
src/cryptopp/config.h
Normal file
@@ -0,0 +1,462 @@
|
||||
#ifndef CRYPTOPP_CONFIG_H
|
||||
#define CRYPTOPP_CONFIG_H
|
||||
|
||||
//// Bitcoin: disable SSE2 on 32-bit
|
||||
#if !defined(_M_X64) && !defined(__x86_64__)
|
||||
#define CRYPTOPP_DISABLE_SSE2 1
|
||||
#endif
|
||||
//////////// end of Bitcoin changes
|
||||
|
||||
|
||||
// ***************** Important Settings ********************
|
||||
|
||||
// define this if running on a big-endian CPU
|
||||
#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
|
||||
# define IS_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
// define this if running on a little-endian CPU
|
||||
// big endian will be assumed if IS_LITTLE_ENDIAN is not defined
|
||||
#ifndef IS_BIG_ENDIAN
|
||||
# define IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
// define this if you want to disable all OS-dependent features,
|
||||
// such as sockets and OS-provided random number generators
|
||||
// #define NO_OS_DEPENDENCE
|
||||
|
||||
// Define this to use features provided by Microsoft's CryptoAPI.
|
||||
// Currently the only feature used is random number generation.
|
||||
// This macro will be ignored if NO_OS_DEPENDENCE is defined.
|
||||
#define USE_MS_CRYPTOAPI
|
||||
|
||||
// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
|
||||
#ifndef DSA_1024_BIT_MODULUS_ONLY
|
||||
# define DSA_1024_BIT_MODULUS_ONLY 1
|
||||
#endif
|
||||
|
||||
// ***************** Less Important Settings ***************
|
||||
|
||||
// define this to retain (as much as possible) old deprecated function and class names
|
||||
// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
|
||||
|
||||
#define GZIP_OS_CODE 0
|
||||
|
||||
// Try this if your CPU has 256K internal cache or a slow multiply instruction
|
||||
// and you want a (possibly) faster IDEA implementation using log tables
|
||||
// #define IDEA_LARGECACHE
|
||||
|
||||
// Define this if, for the linear congruential RNG, you want to use
|
||||
// the original constants as specified in S.K. Park and K.W. Miller's
|
||||
// CACM paper.
|
||||
// #define LCRNG_ORIGINAL_NUMBERS
|
||||
|
||||
// choose which style of sockets to wrap (mostly useful for cygwin which has both)
|
||||
#define PREFER_BERKELEY_STYLE_SOCKETS
|
||||
// #define PREFER_WINDOWS_STYLE_SOCKETS
|
||||
|
||||
// set the name of Rijndael cipher, was "Rijndael" before version 5.3
|
||||
#define CRYPTOPP_RIJNDAEL_NAME "AES"
|
||||
|
||||
// ***************** Important Settings Again ********************
|
||||
// But the defaults should be ok.
|
||||
|
||||
// namespace support is now required
|
||||
#ifdef NO_NAMESPACE
|
||||
# error namespace support is now required
|
||||
#endif
|
||||
|
||||
// Define this to workaround a Microsoft CryptoAPI bug where
|
||||
// each call to CryptAcquireContext causes a 100 KB memory leak.
|
||||
// Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
|
||||
#define WORKAROUND_MS_BUG_Q258000
|
||||
|
||||
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
|
||||
// Avoid putting "CryptoPP::" in front of everything in Doxygen output
|
||||
# define CryptoPP
|
||||
# define NAMESPACE_BEGIN(x)
|
||||
# define NAMESPACE_END
|
||||
// Get Doxygen to generate better documentation for these typedefs
|
||||
# define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
|
||||
#else
|
||||
# define NAMESPACE_BEGIN(x) namespace x {
|
||||
# define NAMESPACE_END }
|
||||
# define DOCUMENTED_TYPEDEF(x, y) typedef x y;
|
||||
#endif
|
||||
#define ANONYMOUS_NAMESPACE_BEGIN namespace {
|
||||
#define USING_NAMESPACE(x) using namespace x;
|
||||
#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
|
||||
#define DOCUMENTED_NAMESPACE_END }
|
||||
|
||||
// What is the type of the third parameter to bind?
|
||||
// For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
|
||||
// Unfortunately there is no way to tell whether or not socklen_t is defined.
|
||||
// To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
|
||||
#ifndef TYPE_OF_SOCKLEN_T
|
||||
# if defined(_WIN32) || defined(__CYGWIN__)
|
||||
# define TYPE_OF_SOCKLEN_T int
|
||||
# else
|
||||
# define TYPE_OF_SOCKLEN_T ::socklen_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
|
||||
# define __USE_W32_SOCKETS
|
||||
#endif
|
||||
|
||||
typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
typedef unsigned short word16;
|
||||
typedef unsigned int word32;
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 word64;
|
||||
#define W64LIT(x) x##ui64
|
||||
#else
|
||||
typedef unsigned long long word64;
|
||||
#define W64LIT(x) x##ULL
|
||||
#endif
|
||||
|
||||
// define large word type, used for file offsets and such
|
||||
typedef word64 lword;
|
||||
const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
// define hword, word, and dword. these are used for multiprecision integer arithmetic
|
||||
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
|
||||
#if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
|
||||
typedef word32 hword;
|
||||
typedef word64 word;
|
||||
#else
|
||||
#define CRYPTOPP_NATIVE_DWORD_AVAILABLE
|
||||
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
|
||||
// GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
|
||||
// mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
|
||||
typedef word32 hword;
|
||||
typedef word64 word;
|
||||
typedef __uint128_t dword;
|
||||
typedef __uint128_t word128;
|
||||
#define CRYPTOPP_WORD128_AVAILABLE
|
||||
#else
|
||||
// if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
|
||||
typedef word16 hword;
|
||||
typedef word32 word;
|
||||
typedef word64 dword;
|
||||
#endif
|
||||
#else
|
||||
// being here means the native register size is probably 32 bits or less
|
||||
#define CRYPTOPP_BOOL_SLOW_WORD64 1
|
||||
typedef word16 hword;
|
||||
typedef word32 word;
|
||||
typedef word64 dword;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CRYPTOPP_BOOL_SLOW_WORD64
|
||||
#define CRYPTOPP_BOOL_SLOW_WORD64 0
|
||||
#endif
|
||||
|
||||
const unsigned int WORD_SIZE = sizeof(word);
|
||||
const unsigned int WORD_BITS = WORD_SIZE * 8;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
|
||||
// This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define CRYPTOPP_L1_CACHE_LINE_SIZE 64
|
||||
#else
|
||||
// L1 cache line size is 32 on Pentium III and earlier
|
||||
#define CRYPTOPP_L1_CACHE_LINE_SIZE 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER == 1200
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if _MSC_VER > 1200 || defined(_mm_free)
|
||||
#define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
|
||||
#else
|
||||
#define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_ALIGN_DATA
|
||||
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
|
||||
#elif defined(__GNUC__)
|
||||
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
|
||||
#else
|
||||
#define CRYPTOPP_ALIGN_DATA(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_SECTION_ALIGN16
|
||||
#if defined(__GNUC__) && !defined(__APPLE__)
|
||||
// the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
|
||||
#define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
|
||||
#else
|
||||
#define CRYPTOPP_SECTION_ALIGN16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__fastcall)
|
||||
#define CRYPTOPP_FASTCALL __fastcall
|
||||
#else
|
||||
#define CRYPTOPP_FASTCALL
|
||||
#endif
|
||||
|
||||
// VC60 workaround: it doesn't allow typename in some places
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
#define CPP_TYPENAME
|
||||
#else
|
||||
#define CPP_TYPENAME typename
|
||||
#endif
|
||||
|
||||
// VC60 workaround: can't cast unsigned __int64 to float or double
|
||||
#if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_VC6_INT64 (__int64)
|
||||
#else
|
||||
#define CRYPTOPP_VC6_INT64
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
|
||||
#else
|
||||
#define CRYPTOPP_NO_VTABLE
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 4231: nonstandard extension used : 'extern' before template explicit instantiation
|
||||
// 4250: dominance
|
||||
// 4251: member needs to have dll-interface
|
||||
// 4275: base needs to have dll-interface
|
||||
// 4660: explicitly instantiating a class that's already implicitly instantiated
|
||||
// 4661: no suitable definition provided for explicit template instantiation request
|
||||
// 4786: identifer was truncated in debug information
|
||||
// 4355: 'this' : used in base member initializer list
|
||||
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
|
||||
# pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
// 8037: non-const function called for const object. needed to work around BCB2006 bug
|
||||
# pragma warn -8037
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
|
||||
#define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
|
||||
#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
|
||||
#define CRYPTOPP_DISABLE_ASM
|
||||
#define CRYPTOPP_DISABLE_SSE2
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
|
||||
#define CRYPTOPP_X86_ASM_AVAILABLE
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
// SSSE3 was actually introduced in GNU as 2.17, which was released 6/23/2006, but we can't tell what version of binutils is installed.
|
||||
// GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version.
|
||||
#if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
|
||||
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
|
||||
#define CRYPTOPP_X64_MASM_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
|
||||
#define CRYPTOPP_X64_ASM_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
|
||||
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
#define CRYPTOPP_BOOL_ALIGN16_ENABLED 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_ALIGN16_ENABLED 0
|
||||
#endif
|
||||
|
||||
// how to allocate 16-byte aligned memory (for SSE2)
|
||||
#if defined(CRYPTOPP_MSVC6PP_OR_LATER)
|
||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
|
||||
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
||||
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
||||
#else
|
||||
#define CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
#endif
|
||||
|
||||
// how to disable inlining
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
||||
#elif defined(__GNUC__)
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||
# define CRYPTOPP_NOINLINE __attribute__((noinline))
|
||||
#else
|
||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
|
||||
# define CRYPTOPP_NOINLINE
|
||||
#endif
|
||||
|
||||
// how to declare class constants
|
||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER)
|
||||
# define CRYPTOPP_CONSTANT(x) enum {x};
|
||||
#else
|
||||
# define CRYPTOPP_CONSTANT(x) static const int x;
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define CRYPTOPP_BOOL_X64 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_X64 0
|
||||
#endif
|
||||
|
||||
// see http://predef.sourceforge.net/prearch.html
|
||||
#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
|
||||
#define CRYPTOPP_BOOL_X86 1
|
||||
#else
|
||||
#define CRYPTOPP_BOOL_X86 0
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__)
|
||||
#define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
|
||||
#endif
|
||||
|
||||
#define CRYPTOPP_VERSION 560
|
||||
|
||||
// ***************** determine availability of OS features ********************
|
||||
|
||||
#ifndef NO_OS_DEPENDENCE
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define CRYPTOPP_WIN32_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
|
||||
#define CRYPTOPP_UNIX_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
|
||||
# define HIGHRES_TIMER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_UNIX_AVAILABLE
|
||||
# define HAS_BERKELEY_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
# define HAS_WINDOWS_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
|
||||
# define SOCKETS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
|
||||
# define USE_WINDOWS_STYLE_SOCKETS
|
||||
#else
|
||||
# define USE_BERKELEY_STYLE_SOCKETS
|
||||
#endif
|
||||
|
||||
#if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
|
||||
# define WINDOWS_PIPES_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
|
||||
# define NONBLOCKING_RNG_AVAILABLE
|
||||
# define OS_RNG_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
# define NONBLOCKING_RNG_AVAILABLE
|
||||
# define BLOCKING_RNG_AVAILABLE
|
||||
# define OS_RNG_AVAILABLE
|
||||
# define HAS_PTHREADS
|
||||
# define THREADS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
# define HAS_WINTHREADS
|
||||
# define THREADS_AVAILABLE
|
||||
#endif
|
||||
|
||||
#endif // NO_OS_DEPENDENCE
|
||||
|
||||
// ***************** DLL related ********************
|
||||
|
||||
#ifdef CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#ifdef CRYPTOPP_EXPORTS
|
||||
#define CRYPTOPP_IS_DLL
|
||||
#define CRYPTOPP_DLL __declspec(dllexport)
|
||||
#elif defined(CRYPTOPP_IMPORTS)
|
||||
#define CRYPTOPP_IS_DLL
|
||||
#define CRYPTOPP_DLL __declspec(dllimport)
|
||||
#else
|
||||
#define CRYPTOPP_DLL
|
||||
#endif
|
||||
|
||||
#define CRYPTOPP_API __cdecl
|
||||
|
||||
#else // CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#define CRYPTOPP_DLL
|
||||
#define CRYPTOPP_API
|
||||
|
||||
#endif // CRYPTOPP_WIN32_AVAILABLE
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
|
||||
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
|
||||
#else
|
||||
#define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
|
||||
#elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
|
||||
#else
|
||||
#define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
|
||||
#else
|
||||
#define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
199
src/cryptopp/cpu.cpp
Normal file
199
src/cryptopp/cpu.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
// cpu.cpp - written and placed in the public domain by Wei Dai
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifndef CRYPTOPP_IMPORTS
|
||||
|
||||
#include "cpu.h"
|
||||
#include "misc.h"
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <signal.h>
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_MSVC6PP_OR_LATER
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#ifdef CRYPTOPP_X86_ASM_AVAILABLE
|
||||
|
||||
#ifndef _MSC_VER
|
||||
typedef void (*SigHandler)(int);
|
||||
|
||||
static jmp_buf s_jmpNoCPUID;
|
||||
static void SigIllHandlerCPUID(int)
|
||||
{
|
||||
longjmp(s_jmpNoCPUID, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CpuId(word32 input, word32 *output)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__try
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov eax, input
|
||||
cpuid
|
||||
mov edi, output
|
||||
mov [edi], eax
|
||||
mov [edi+4], ebx
|
||||
mov [edi+8], ecx
|
||||
mov [edi+12], edx
|
||||
}
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
SigHandler oldHandler = signal(SIGILL, SigIllHandlerCPUID);
|
||||
if (oldHandler == SIG_ERR)
|
||||
return false;
|
||||
|
||||
bool result = true;
|
||||
if (setjmp(s_jmpNoCPUID))
|
||||
result = false;
|
||||
else
|
||||
{
|
||||
__asm__
|
||||
(
|
||||
// save ebx in case -fPIC is being used
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
"push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx"
|
||||
#else
|
||||
"pushq %%rbx; cpuid; mov %%ebx, %%edi; popq %%rbx"
|
||||
#endif
|
||||
: "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d" (output[3])
|
||||
: "a" (input)
|
||||
);
|
||||
}
|
||||
|
||||
signal(SIGILL, oldHandler);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
static jmp_buf s_jmpNoSSE2;
|
||||
static void SigIllHandlerSSE2(int)
|
||||
{
|
||||
longjmp(s_jmpNoSSE2, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif _MSC_VER >= 1400 && CRYPTOPP_BOOL_X64
|
||||
|
||||
bool CpuId(word32 input, word32 *output)
|
||||
{
|
||||
__cpuid((int *)output, input);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_CPUID_AVAILABLE
|
||||
|
||||
static bool TrySSE2()
|
||||
{
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
return true;
|
||||
#elif defined(_MSC_VER)
|
||||
__try
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
AS2(por xmm0, xmm0) // executing SSE2 instruction
|
||||
#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
||||
__mm128i x = _mm_setzero_si128();
|
||||
return _mm_cvtsi128_si32(x) == 0;
|
||||
#endif
|
||||
}
|
||||
__except (1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#elif defined(__GNUC__)
|
||||
SigHandler oldHandler = signal(SIGILL, SigIllHandlerSSE2);
|
||||
if (oldHandler == SIG_ERR)
|
||||
return false;
|
||||
|
||||
bool result = true;
|
||||
if (setjmp(s_jmpNoSSE2))
|
||||
result = false;
|
||||
else
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
__asm __volatile ("por %xmm0, %xmm0");
|
||||
#elif CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
||||
__mm128i x = _mm_setzero_si128();
|
||||
result = _mm_cvtsi128_si32(x) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
signal(SIGILL, oldHandler);
|
||||
return result;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool g_x86DetectionDone = false;
|
||||
bool g_hasISSE = false, g_hasSSE2 = false, g_hasSSSE3 = false, g_hasMMX = false, g_isP4 = false;
|
||||
word32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
|
||||
void DetectX86Features()
|
||||
{
|
||||
word32 cpuid[4], cpuid1[4];
|
||||
if (!CpuId(0, cpuid))
|
||||
return;
|
||||
if (!CpuId(1, cpuid1))
|
||||
return;
|
||||
|
||||
g_hasMMX = (cpuid1[3] & (1 << 23)) != 0;
|
||||
if ((cpuid1[3] & (1 << 26)) != 0)
|
||||
g_hasSSE2 = TrySSE2();
|
||||
g_hasSSSE3 = g_hasSSE2 && (cpuid1[2] & (1<<9));
|
||||
|
||||
if ((cpuid1[3] & (1 << 25)) != 0)
|
||||
g_hasISSE = true;
|
||||
else
|
||||
{
|
||||
word32 cpuid2[4];
|
||||
CpuId(0x080000000, cpuid2);
|
||||
if (cpuid2[0] >= 0x080000001)
|
||||
{
|
||||
CpuId(0x080000001, cpuid2);
|
||||
g_hasISSE = (cpuid2[3] & (1 << 22)) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::swap(cpuid[2], cpuid[3]);
|
||||
if (memcmp(cpuid+1, "GenuineIntel", 12) == 0)
|
||||
{
|
||||
g_isP4 = ((cpuid1[0] >> 8) & 0xf) == 0xf;
|
||||
g_cacheLineSize = 8 * GETBYTE(cpuid1[1], 1);
|
||||
}
|
||||
else if (memcmp(cpuid+1, "AuthenticAMD", 12) == 0)
|
||||
{
|
||||
CpuId(0x80000005, cpuid);
|
||||
g_cacheLineSize = GETBYTE(cpuid[2], 0);
|
||||
}
|
||||
|
||||
if (!g_cacheLineSize)
|
||||
g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
|
||||
g_x86DetectionDone = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
263
src/cryptopp/cpu.h
Normal file
263
src/cryptopp/cpu.h
Normal file
@@ -0,0 +1,263 @@
|
||||
#ifndef CRYPTOPP_CPU_H
|
||||
#define CRYPTOPP_CPU_H
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#define CRYPTOPP_X86_ASM_AVAILABLE
|
||||
#define CRYPTOPP_BOOL_X64 1
|
||||
#define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
|
||||
#define NAMESPACE_END
|
||||
|
||||
#else
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef CRYPTOPP_MSVC6PP_OR_LATER
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || (_MSC_VER >= 1400 && CRYPTOPP_BOOL_X64)
|
||||
|
||||
#define CRYPTOPP_CPUID_AVAILABLE
|
||||
|
||||
// these should not be used directly
|
||||
extern CRYPTOPP_DLL bool g_x86DetectionDone;
|
||||
extern CRYPTOPP_DLL bool g_hasSSE2;
|
||||
extern CRYPTOPP_DLL bool g_hasISSE;
|
||||
extern CRYPTOPP_DLL bool g_hasMMX;
|
||||
extern CRYPTOPP_DLL bool g_hasSSSE3;
|
||||
extern CRYPTOPP_DLL bool g_isP4;
|
||||
extern CRYPTOPP_DLL word32 g_cacheLineSize;
|
||||
CRYPTOPP_DLL void CRYPTOPP_API DetectX86Features();
|
||||
|
||||
CRYPTOPP_DLL bool CRYPTOPP_API CpuId(word32 input, word32 *output);
|
||||
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
inline bool HasSSE2() {return true;}
|
||||
inline bool HasISSE() {return true;}
|
||||
inline bool HasMMX() {return true;}
|
||||
#else
|
||||
|
||||
inline bool HasSSE2()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasSSE2;
|
||||
}
|
||||
|
||||
inline bool HasISSE()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasISSE;
|
||||
}
|
||||
|
||||
inline bool HasMMX()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasMMX;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool HasSSSE3()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_hasSSSE3;
|
||||
}
|
||||
|
||||
inline bool IsP4()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_isP4;
|
||||
}
|
||||
|
||||
inline int GetCacheLineSize()
|
||||
{
|
||||
if (!g_x86DetectionDone)
|
||||
DetectX86Features();
|
||||
return g_cacheLineSize;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline int GetCacheLineSize()
|
||||
{
|
||||
return CRYPTOPP_L1_CACHE_LINE_SIZE;
|
||||
}
|
||||
|
||||
inline bool HasSSSE3() {return false;}
|
||||
inline bool IsP4() {return false;}
|
||||
|
||||
// assume MMX and SSE2 if intrinsics are enabled
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_X64
|
||||
inline bool HasSSE2() {return true;}
|
||||
inline bool HasISSE() {return true;}
|
||||
inline bool HasMMX() {return true;}
|
||||
#else
|
||||
inline bool HasSSE2() {return false;}
|
||||
inline bool HasISSE() {return false;}
|
||||
inline bool HasMMX() {return false;}
|
||||
#endif
|
||||
|
||||
#endif // #ifdef CRYPTOPP_X86_ASM_AVAILABLE || _MSC_VER >= 1400
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define AS1(x) x*newline*
|
||||
#define AS2(x, y) x, y*newline*
|
||||
#define AS3(x, y, z) x, y, z*newline*
|
||||
#define ASS(x, y, a, b, c, d) x, y, a*64+b*16+c*4+d*newline*
|
||||
#define ASL(x) label##x:*newline*
|
||||
#define ASJ(x, y, z) x label##y*newline*
|
||||
#define ASC(x, y) x label##y*newline*
|
||||
#define AS_HEX(y) 0##y##h
|
||||
#elif defined(__GNUC__)
|
||||
// define these in two steps to allow arguments to be expanded
|
||||
#define GNU_AS1(x) #x ";"
|
||||
#define GNU_AS2(x, y) #x ", " #y ";"
|
||||
#define GNU_AS3(x, y, z) #x ", " #y ", " #z ";"
|
||||
#define GNU_ASL(x) "\n" #x ":"
|
||||
#define GNU_ASJ(x, y, z) #x " " #y #z ";"
|
||||
#define AS1(x) GNU_AS1(x)
|
||||
#define AS2(x, y) GNU_AS2(x, y)
|
||||
#define AS3(x, y, z) GNU_AS3(x, y, z)
|
||||
#define ASS(x, y, a, b, c, d) #x ", " #y ", " #a "*64+" #b "*16+" #c "*4+" #d ";"
|
||||
#define ASL(x) GNU_ASL(x)
|
||||
#define ASJ(x, y, z) GNU_ASJ(x, y, z)
|
||||
#define ASC(x, y) #x " " #y ";"
|
||||
#define CRYPTOPP_NAKED
|
||||
#define AS_HEX(y) 0x##y
|
||||
#else
|
||||
#define AS1(x) __asm {x}
|
||||
#define AS2(x, y) __asm {x, y}
|
||||
#define AS3(x, y, z) __asm {x, y, z}
|
||||
#define ASS(x, y, a, b, c, d) __asm {x, y, _MM_SHUFFLE(a, b, c, d)}
|
||||
#define ASL(x) __asm {label##x:}
|
||||
#define ASJ(x, y, z) __asm {x label##y}
|
||||
#define ASC(x, y) __asm {x label##y}
|
||||
#define CRYPTOPP_NAKED __declspec(naked)
|
||||
#define AS_HEX(y) 0x##y
|
||||
#endif
|
||||
|
||||
#define IF0(y)
|
||||
#define IF1(y) y
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define ASM_MOD(x, y) ((x) MOD (y))
|
||||
#define XMMWORD_PTR XMMWORD PTR
|
||||
#else
|
||||
// GNU assembler doesn't seem to have mod operator
|
||||
#define ASM_MOD(x, y) ((x)-((x)/(y))*(y))
|
||||
// GAS 2.15 doesn't support XMMWORD PTR. it seems necessary only for MASM
|
||||
#define XMMWORD_PTR
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#define AS_REG_1 ecx
|
||||
#define AS_REG_2 edx
|
||||
#define AS_REG_3 esi
|
||||
#define AS_REG_4 edi
|
||||
#define AS_REG_5 eax
|
||||
#define AS_REG_6 ebx
|
||||
#define AS_REG_7 ebp
|
||||
#define AS_REG_1d ecx
|
||||
#define AS_REG_2d edx
|
||||
#define AS_REG_3d esi
|
||||
#define AS_REG_4d edi
|
||||
#define AS_REG_5d eax
|
||||
#define AS_REG_6d ebx
|
||||
#define AS_REG_7d ebp
|
||||
#define WORD_SZ 4
|
||||
#define WORD_REG(x) e##x
|
||||
#define WORD_PTR DWORD PTR
|
||||
#define AS_PUSH_IF86(x) AS1(push e##x)
|
||||
#define AS_POP_IF86(x) AS1(pop e##x)
|
||||
#define AS_JCXZ jecxz
|
||||
#elif CRYPTOPP_BOOL_X64
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
#define AS_REG_1 rcx
|
||||
#define AS_REG_2 rdx
|
||||
#define AS_REG_3 r8
|
||||
#define AS_REG_4 r9
|
||||
#define AS_REG_5 rax
|
||||
#define AS_REG_6 r10
|
||||
#define AS_REG_7 r11
|
||||
#define AS_REG_1d ecx
|
||||
#define AS_REG_2d edx
|
||||
#define AS_REG_3d r8d
|
||||
#define AS_REG_4d r9d
|
||||
#define AS_REG_5d eax
|
||||
#define AS_REG_6d r10d
|
||||
#define AS_REG_7d r11d
|
||||
#else
|
||||
#define AS_REG_1 rdi
|
||||
#define AS_REG_2 rsi
|
||||
#define AS_REG_3 rdx
|
||||
#define AS_REG_4 rcx
|
||||
#define AS_REG_5 r8
|
||||
#define AS_REG_6 r9
|
||||
#define AS_REG_7 r10
|
||||
#define AS_REG_1d edi
|
||||
#define AS_REG_2d esi
|
||||
#define AS_REG_3d edx
|
||||
#define AS_REG_4d ecx
|
||||
#define AS_REG_5d r8d
|
||||
#define AS_REG_6d r9d
|
||||
#define AS_REG_7d r10d
|
||||
#endif
|
||||
#define WORD_SZ 8
|
||||
#define WORD_REG(x) r##x
|
||||
#define WORD_PTR QWORD PTR
|
||||
#define AS_PUSH_IF86(x)
|
||||
#define AS_POP_IF86(x)
|
||||
#define AS_JCXZ jrcxz
|
||||
#endif
|
||||
|
||||
// helper macro for stream cipher output
|
||||
#define AS_XMM_OUTPUT4(labelPrefix, inputPtr, outputPtr, x0, x1, x2, x3, t, p0, p1, p2, p3, increment)\
|
||||
AS2( test inputPtr, inputPtr)\
|
||||
ASC( jz, labelPrefix##3)\
|
||||
AS2( test inputPtr, 15)\
|
||||
ASC( jnz, labelPrefix##7)\
|
||||
AS2( pxor xmm##x0, [inputPtr+p0*16])\
|
||||
AS2( pxor xmm##x1, [inputPtr+p1*16])\
|
||||
AS2( pxor xmm##x2, [inputPtr+p2*16])\
|
||||
AS2( pxor xmm##x3, [inputPtr+p3*16])\
|
||||
AS2( add inputPtr, increment*16)\
|
||||
ASC( jmp, labelPrefix##3)\
|
||||
ASL(labelPrefix##7)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p0*16])\
|
||||
AS2( pxor xmm##x0, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p1*16])\
|
||||
AS2( pxor xmm##x1, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p2*16])\
|
||||
AS2( pxor xmm##x2, xmm##t)\
|
||||
AS2( movdqu xmm##t, [inputPtr+p3*16])\
|
||||
AS2( pxor xmm##x3, xmm##t)\
|
||||
AS2( add inputPtr, increment*16)\
|
||||
ASL(labelPrefix##3)\
|
||||
AS2( test outputPtr, 15)\
|
||||
ASC( jnz, labelPrefix##8)\
|
||||
AS2( movdqa [outputPtr+p0*16], xmm##x0)\
|
||||
AS2( movdqa [outputPtr+p1*16], xmm##x1)\
|
||||
AS2( movdqa [outputPtr+p2*16], xmm##x2)\
|
||||
AS2( movdqa [outputPtr+p3*16], xmm##x3)\
|
||||
ASC( jmp, labelPrefix##9)\
|
||||
ASL(labelPrefix##8)\
|
||||
AS2( movdqu [outputPtr+p0*16], xmm##x0)\
|
||||
AS2( movdqu [outputPtr+p1*16], xmm##x1)\
|
||||
AS2( movdqu [outputPtr+p2*16], xmm##x2)\
|
||||
AS2( movdqu [outputPtr+p3*16], xmm##x3)\
|
||||
ASL(labelPrefix##9)\
|
||||
AS2( add outputPtr, increment*16)
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1668
src/cryptopp/cryptlib.h
Normal file
1668
src/cryptopp/cryptlib.h
Normal file
File diff suppressed because it is too large
Load Diff
29
src/cryptopp/iterhash.h
Normal file
29
src/cryptopp/iterhash.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef CRYPTOPP_ITERHASH_H
|
||||
#define CRYPTOPP_ITERHASH_H
|
||||
|
||||
#include "secblock.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// *** trimmed down dependency from iterhash.h ***
|
||||
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
|
||||
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
|
||||
unsigned int DigestSize() const {return DIGESTSIZE;};
|
||||
typedef T_HashWordType HashWordType;
|
||||
CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
|
||||
|
||||
protected:
|
||||
IteratedHashWithStaticTransform() {this->Init();}
|
||||
void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_state, data);}
|
||||
void Init() {T_Transform::InitState(this->m_state);}
|
||||
|
||||
T_HashWordType* StateBuf() {return this->m_state;}
|
||||
FixedSizeAlignedSecBlock<T_HashWordType, T_BlockSize/sizeof(T_HashWordType), T_StateAligned> m_state;
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1134
src/cryptopp/misc.h
Normal file
1134
src/cryptopp/misc.h
Normal file
File diff suppressed because it is too large
Load Diff
2
src/cryptopp/obj/.gitignore
vendored
Normal file
2
src/cryptopp/obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
21
src/cryptopp/pch.h
Normal file
21
src/cryptopp/pch.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef CRYPTOPP_PCH_H
|
||||
#define CRYPTOPP_PCH_H
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_PRECOMPILED_HEADERS
|
||||
#include "simple.h"
|
||||
#include "secblock.h"
|
||||
#include "misc.h"
|
||||
#include "smartptr.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
501
src/cryptopp/secblock.h
Normal file
501
src/cryptopp/secblock.h
Normal file
@@ -0,0 +1,501 @@
|
||||
// secblock.h - written and placed in the public domain by Wei Dai
|
||||
|
||||
#ifndef CRYPTOPP_SECBLOCK_H
|
||||
#define CRYPTOPP_SECBLOCK_H
|
||||
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(CRYPTOPP_MEMALIGN_AVAILABLE) || defined(CRYPTOPP_MM_MALLOC_AVAILABLE) || defined(QNX)
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// ************** secure memory allocation ***************
|
||||
|
||||
template<class T>
|
||||
class AllocatorBase
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef size_t size_type;
|
||||
#ifdef CRYPTOPP_MSVCRT6
|
||||
typedef ptrdiff_t difference_type;
|
||||
#else
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
#endif
|
||||
typedef T * pointer;
|
||||
typedef const T * const_pointer;
|
||||
typedef T & reference;
|
||||
typedef const T & const_reference;
|
||||
|
||||
pointer address(reference r) const {return (&r);}
|
||||
const_pointer address(const_reference r) const {return (&r); }
|
||||
void construct(pointer p, const T& val) {new (p) T(val);}
|
||||
void destroy(pointer p) {p->~T();}
|
||||
size_type max_size() const {return ~size_type(0)/sizeof(T);} // switch to std::numeric_limits<T>::max later
|
||||
|
||||
protected:
|
||||
static void CheckSize(size_t n)
|
||||
{
|
||||
if (n > ~size_t(0) / sizeof(T))
|
||||
throw InvalidArgument("AllocatorBase: requested size would cause integer overflow");
|
||||
}
|
||||
};
|
||||
|
||||
#define CRYPTOPP_INHERIT_ALLOCATOR_TYPES \
|
||||
typedef typename AllocatorBase<T>::value_type value_type;\
|
||||
typedef typename AllocatorBase<T>::size_type size_type;\
|
||||
typedef typename AllocatorBase<T>::difference_type difference_type;\
|
||||
typedef typename AllocatorBase<T>::pointer pointer;\
|
||||
typedef typename AllocatorBase<T>::const_pointer const_pointer;\
|
||||
typedef typename AllocatorBase<T>::reference reference;\
|
||||
typedef typename AllocatorBase<T>::const_reference const_reference;
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
// this pragma causes an internal compiler error if placed immediately before std::swap(a, b)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4700) // VC60 workaround: don't know how to get rid of this warning
|
||||
#endif
|
||||
|
||||
template <class T, class A>
|
||||
typename A::pointer StandardReallocate(A& a, T *p, typename A::size_type oldSize, typename A::size_type newSize, bool preserve)
|
||||
{
|
||||
if (oldSize == newSize)
|
||||
return p;
|
||||
|
||||
if (preserve)
|
||||
{
|
||||
typename A::pointer newPointer = a.allocate(newSize, NULL);
|
||||
memcpy_s(newPointer, sizeof(T)*newSize, p, sizeof(T)*STDMIN(oldSize, newSize));
|
||||
a.deallocate(p, oldSize);
|
||||
return newPointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
a.deallocate(p, oldSize);
|
||||
return a.allocate(newSize, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <class T, bool T_Align16 = false>
|
||||
class AllocatorWithCleanup : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
pointer allocate(size_type n, const void * = NULL)
|
||||
{
|
||||
CheckSize(n);
|
||||
if (n == 0)
|
||||
return NULL;
|
||||
|
||||
if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16)
|
||||
{
|
||||
byte *p;
|
||||
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
while (!(p = (byte *)_mm_malloc(sizeof(T)*n, 16)))
|
||||
#elif defined(CRYPTOPP_MEMALIGN_AVAILABLE)
|
||||
while (!(p = (byte *)memalign(16, sizeof(T)*n)))
|
||||
#elif defined(CRYPTOPP_MALLOC_ALIGNMENT_IS_16)
|
||||
while (!(p = (byte *)malloc(sizeof(T)*n)))
|
||||
#else
|
||||
while (!(p = (byte *)malloc(sizeof(T)*n + 16)))
|
||||
#endif
|
||||
CallNewHandler();
|
||||
|
||||
#ifdef CRYPTOPP_NO_ALIGNED_ALLOC
|
||||
size_t adjustment = 16-((size_t)p%16);
|
||||
p += adjustment;
|
||||
p[-1] = (byte)adjustment;
|
||||
#endif
|
||||
|
||||
assert(IsAlignedOn(p, 16));
|
||||
return (pointer)p;
|
||||
}
|
||||
|
||||
pointer p;
|
||||
while (!(p = (pointer)malloc(sizeof(T)*n)))
|
||||
CallNewHandler();
|
||||
return p;
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
memset_z(p, 0, n*sizeof(T));
|
||||
|
||||
if (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16 && n*sizeof(T) >= 16)
|
||||
{
|
||||
#ifdef CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||
_mm_free(p);
|
||||
#elif defined(CRYPTOPP_NO_ALIGNED_ALLOC)
|
||||
p = (byte *)p - ((byte *)p)[-1];
|
||||
free(p);
|
||||
#else
|
||||
free(p);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
pointer reallocate(T *p, size_type oldSize, size_type newSize, bool preserve)
|
||||
{
|
||||
return StandardReallocate(*this, p, oldSize, newSize, preserve);
|
||||
}
|
||||
|
||||
// VS.NET STL enforces the policy of "All STL-compliant allocators have to provide a
|
||||
// template class member called rebind".
|
||||
template <class U> struct rebind { typedef AllocatorWithCleanup<U, T_Align16> other; };
|
||||
#if _MSC_VER >= 1500
|
||||
AllocatorWithCleanup() {}
|
||||
template <class U, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<U, A> &) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<byte>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word16>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word32>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word64>;
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS AllocatorWithCleanup<word, true>; // for Integer
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
class NullAllocator : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
pointer allocate(size_type n, const void * = NULL)
|
||||
{
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
//// Bitcoin: don't know why this trips, probably a false alarm, depends on the compiler used.
|
||||
//assert(false);
|
||||
}
|
||||
|
||||
size_type max_size() const {return 0;}
|
||||
};
|
||||
|
||||
// This allocator can't be used with standard collections because
|
||||
// they require that all objects of the same allocator type are equivalent.
|
||||
// So this is for use with SecBlock only.
|
||||
template <class T, size_t S, class A = NullAllocator<T>, bool T_Align16 = false>
|
||||
class FixedSizeAllocatorWithCleanup : public AllocatorBase<T>
|
||||
{
|
||||
public:
|
||||
CRYPTOPP_INHERIT_ALLOCATOR_TYPES
|
||||
|
||||
FixedSizeAllocatorWithCleanup() : m_allocated(false) {}
|
||||
|
||||
pointer allocate(size_type n)
|
||||
{
|
||||
assert(IsAlignedOn(m_array, 8));
|
||||
|
||||
if (n <= S && !m_allocated)
|
||||
{
|
||||
m_allocated = true;
|
||||
return GetAlignedArray();
|
||||
}
|
||||
else
|
||||
return m_fallbackAllocator.allocate(n);
|
||||
}
|
||||
|
||||
pointer allocate(size_type n, const void *hint)
|
||||
{
|
||||
if (n <= S && !m_allocated)
|
||||
{
|
||||
m_allocated = true;
|
||||
return GetAlignedArray();
|
||||
}
|
||||
else
|
||||
return m_fallbackAllocator.allocate(n, hint);
|
||||
}
|
||||
|
||||
void deallocate(void *p, size_type n)
|
||||
{
|
||||
if (p == GetAlignedArray())
|
||||
{
|
||||
assert(n <= S);
|
||||
assert(m_allocated);
|
||||
m_allocated = false;
|
||||
memset(p, 0, n*sizeof(T));
|
||||
}
|
||||
else
|
||||
m_fallbackAllocator.deallocate(p, n);
|
||||
}
|
||||
|
||||
pointer reallocate(pointer p, size_type oldSize, size_type newSize, bool preserve)
|
||||
{
|
||||
if (p == GetAlignedArray() && newSize <= S)
|
||||
{
|
||||
assert(oldSize <= S);
|
||||
if (oldSize > newSize)
|
||||
memset(p + newSize, 0, (oldSize-newSize)*sizeof(T));
|
||||
return p;
|
||||
}
|
||||
|
||||
pointer newPointer = allocate(newSize, NULL);
|
||||
if (preserve)
|
||||
memcpy(newPointer, p, sizeof(T)*STDMIN(oldSize, newSize));
|
||||
deallocate(p, oldSize);
|
||||
return newPointer;
|
||||
}
|
||||
|
||||
size_type max_size() const {return STDMAX(m_fallbackAllocator.max_size(), S);}
|
||||
|
||||
private:
|
||||
#ifdef __BORLANDC__
|
||||
T* GetAlignedArray() {return m_array;}
|
||||
T m_array[S];
|
||||
#else
|
||||
T* GetAlignedArray() {return (CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? (T*)(((byte *)m_array) + (0-(size_t)m_array)%16) : m_array;}
|
||||
CRYPTOPP_ALIGN_DATA(8) T m_array[(CRYPTOPP_BOOL_ALIGN16_ENABLED && T_Align16) ? S+8/sizeof(T) : S];
|
||||
#endif
|
||||
A m_fallbackAllocator;
|
||||
bool m_allocated;
|
||||
};
|
||||
|
||||
//! a block of memory allocated using A
|
||||
template <class T, class A = AllocatorWithCleanup<T> >
|
||||
class SecBlock
|
||||
{
|
||||
public:
|
||||
typedef typename A::value_type value_type;
|
||||
typedef typename A::pointer iterator;
|
||||
typedef typename A::const_pointer const_iterator;
|
||||
typedef typename A::size_type size_type;
|
||||
|
||||
explicit SecBlock(size_type size=0)
|
||||
: m_size(size) {m_ptr = m_alloc.allocate(size, NULL);}
|
||||
SecBlock(const SecBlock<T, A> &t)
|
||||
: m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));}
|
||||
SecBlock(const T *t, size_type len)
|
||||
: m_size(len)
|
||||
{
|
||||
m_ptr = m_alloc.allocate(len, NULL);
|
||||
if (t == NULL)
|
||||
memset_z(m_ptr, 0, len*sizeof(T));
|
||||
else
|
||||
memcpy(m_ptr, t, len*sizeof(T));
|
||||
}
|
||||
|
||||
~SecBlock()
|
||||
{m_alloc.deallocate(m_ptr, m_size);}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
operator T *() const
|
||||
{return (T*)m_ptr;}
|
||||
#else
|
||||
operator const void *() const
|
||||
{return m_ptr;}
|
||||
operator void *()
|
||||
{return m_ptr;}
|
||||
|
||||
operator const T *() const
|
||||
{return m_ptr;}
|
||||
operator T *()
|
||||
{return m_ptr;}
|
||||
#endif
|
||||
|
||||
// T *operator +(size_type offset)
|
||||
// {return m_ptr+offset;}
|
||||
|
||||
// const T *operator +(size_type offset) const
|
||||
// {return m_ptr+offset;}
|
||||
|
||||
// T& operator[](size_type index)
|
||||
// {assert(index >= 0 && index < m_size); return m_ptr[index];}
|
||||
|
||||
// const T& operator[](size_type index) const
|
||||
// {assert(index >= 0 && index < m_size); return m_ptr[index];}
|
||||
|
||||
iterator begin()
|
||||
{return m_ptr;}
|
||||
const_iterator begin() const
|
||||
{return m_ptr;}
|
||||
iterator end()
|
||||
{return m_ptr+m_size;}
|
||||
const_iterator end() const
|
||||
{return m_ptr+m_size;}
|
||||
|
||||
typename A::pointer data() {return m_ptr;}
|
||||
typename A::const_pointer data() const {return m_ptr;}
|
||||
|
||||
size_type size() const {return m_size;}
|
||||
bool empty() const {return m_size == 0;}
|
||||
|
||||
byte * BytePtr() {return (byte *)m_ptr;}
|
||||
const byte * BytePtr() const {return (const byte *)m_ptr;}
|
||||
size_type SizeInBytes() const {return m_size*sizeof(T);}
|
||||
|
||||
//! set contents and size
|
||||
void Assign(const T *t, size_type len)
|
||||
{
|
||||
New(len);
|
||||
memcpy_s(m_ptr, m_size*sizeof(T), t, len*sizeof(T));
|
||||
}
|
||||
|
||||
//! copy contents and size from another SecBlock
|
||||
void Assign(const SecBlock<T, A> &t)
|
||||
{
|
||||
New(t.m_size);
|
||||
memcpy_s(m_ptr, m_size*sizeof(T), t.m_ptr, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
SecBlock<T, A>& operator=(const SecBlock<T, A> &t)
|
||||
{
|
||||
Assign(t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// append to this object
|
||||
SecBlock<T, A>& operator+=(const SecBlock<T, A> &t)
|
||||
{
|
||||
size_type oldSize = m_size;
|
||||
Grow(m_size+t.m_size);
|
||||
memcpy_s(m_ptr+oldSize, m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// append operator
|
||||
SecBlock<T, A> operator+(const SecBlock<T, A> &t)
|
||||
{
|
||||
SecBlock<T, A> result(m_size+t.m_size);
|
||||
memcpy_s(result.m_ptr, result.m_size*sizeof(T), m_ptr, m_size*sizeof(T));
|
||||
memcpy_s(result.m_ptr+m_size, t.m_size*sizeof(T), t.m_ptr, t.m_size*sizeof(T));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const SecBlock<T, A> &t) const
|
||||
{
|
||||
return m_size == t.m_size && VerifyBufsEqual(m_ptr, t.m_ptr, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
bool operator!=(const SecBlock<T, A> &t) const
|
||||
{
|
||||
return !operator==(t);
|
||||
}
|
||||
|
||||
//! change size, without preserving contents
|
||||
void New(size_type newSize)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, false);
|
||||
m_size = newSize;
|
||||
}
|
||||
|
||||
//! change size and set contents to 0
|
||||
void CleanNew(size_type newSize)
|
||||
{
|
||||
New(newSize);
|
||||
memset_z(m_ptr, 0, m_size*sizeof(T));
|
||||
}
|
||||
|
||||
//! change size only if newSize > current size. contents are preserved
|
||||
void Grow(size_type newSize)
|
||||
{
|
||||
if (newSize > m_size)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
m_size = newSize;
|
||||
}
|
||||
}
|
||||
|
||||
//! change size only if newSize > current size. contents are preserved and additional area is set to 0
|
||||
void CleanGrow(size_type newSize)
|
||||
{
|
||||
if (newSize > m_size)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
memset(m_ptr+m_size, 0, (newSize-m_size)*sizeof(T));
|
||||
m_size = newSize;
|
||||
}
|
||||
}
|
||||
|
||||
//! change size and preserve contents
|
||||
void resize(size_type newSize)
|
||||
{
|
||||
m_ptr = m_alloc.reallocate(m_ptr, m_size, newSize, true);
|
||||
m_size = newSize;
|
||||
}
|
||||
|
||||
//! swap contents and size with another SecBlock
|
||||
void swap(SecBlock<T, A> &b)
|
||||
{
|
||||
std::swap(m_alloc, b.m_alloc);
|
||||
std::swap(m_size, b.m_size);
|
||||
std::swap(m_ptr, b.m_ptr);
|
||||
}
|
||||
|
||||
//private:
|
||||
A m_alloc;
|
||||
size_type m_size;
|
||||
T *m_ptr;
|
||||
};
|
||||
|
||||
typedef SecBlock<byte> SecByteBlock;
|
||||
typedef SecBlock<byte, AllocatorWithCleanup<byte, true> > AlignedSecByteBlock;
|
||||
typedef SecBlock<word> SecWordBlock;
|
||||
|
||||
//! a SecBlock with fixed size, allocated statically
|
||||
template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S> >
|
||||
class FixedSizeSecBlock : public SecBlock<T, A>
|
||||
{
|
||||
public:
|
||||
explicit FixedSizeSecBlock() : SecBlock<T, A>(S) {}
|
||||
};
|
||||
|
||||
template <class T, unsigned int S, bool T_Align16 = true>
|
||||
class FixedSizeAlignedSecBlock : public FixedSizeSecBlock<T, S, FixedSizeAllocatorWithCleanup<T, S, NullAllocator<T>, T_Align16> >
|
||||
{
|
||||
};
|
||||
|
||||
//! a SecBlock that preallocates size S statically, and uses the heap when this size is exceeded
|
||||
template <class T, unsigned int S, class A = FixedSizeAllocatorWithCleanup<T, S, AllocatorWithCleanup<T> > >
|
||||
class SecBlockWithHint : public SecBlock<T, A>
|
||||
{
|
||||
public:
|
||||
explicit SecBlockWithHint(size_t size) : SecBlock<T, A>(size) {}
|
||||
};
|
||||
|
||||
template<class T, bool A, class U, bool B>
|
||||
inline bool operator==(const CryptoPP::AllocatorWithCleanup<T, A>&, const CryptoPP::AllocatorWithCleanup<U, B>&) {return (true);}
|
||||
template<class T, bool A, class U, bool B>
|
||||
inline bool operator!=(const CryptoPP::AllocatorWithCleanup<T, A>&, const CryptoPP::AllocatorWithCleanup<U, B>&) {return (false);}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
NAMESPACE_BEGIN(std)
|
||||
template <class T, class A>
|
||||
inline void swap(CryptoPP::SecBlock<T, A> &a, CryptoPP::SecBlock<T, A> &b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#if defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || (defined(_STLPORT_VERSION) && !defined(_STLP_MEMBER_TEMPLATE_CLASSES))
|
||||
// working for STLport 5.1.3 and MSVC 6 SP5
|
||||
template <class _Tp1, class _Tp2>
|
||||
inline CryptoPP::AllocatorWithCleanup<_Tp2>&
|
||||
__stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*)
|
||||
{
|
||||
return (CryptoPP::AllocatorWithCleanup<_Tp2>&)(__a);
|
||||
}
|
||||
#endif
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
899
src/cryptopp/sha.cpp
Normal file
899
src/cryptopp/sha.cpp
Normal file
@@ -0,0 +1,899 @@
|
||||
// sha.cpp - modified by Wei Dai from Steve Reid's public domain sha1.c
|
||||
|
||||
// Steve Reid implemented SHA-1. Wei Dai implemented SHA-2.
|
||||
// Both are in the public domain.
|
||||
|
||||
// use "cl /EP /P /DCRYPTOPP_GENERATE_X64_MASM sha.cpp" to generate MASM code
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
#ifndef CRYPTOPP_IMPORTS
|
||||
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#include "sha.h"
|
||||
#include "misc.h"
|
||||
#include "cpu.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// start of Steve Reid's code
|
||||
|
||||
#define blk0(i) (W[i] = data[i])
|
||||
#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
|
||||
|
||||
void SHA1::InitState(HashWordType *state)
|
||||
{
|
||||
state[0] = 0x67452301L;
|
||||
state[1] = 0xEFCDAB89L;
|
||||
state[2] = 0x98BADCFEL;
|
||||
state[3] = 0x10325476L;
|
||||
state[4] = 0xC3D2E1F0L;
|
||||
}
|
||||
|
||||
#define f1(x,y,z) (z^(x&(y^z)))
|
||||
#define f2(x,y,z) (x^y^z)
|
||||
#define f3(x,y,z) ((x&y)|(z&(x|y)))
|
||||
#define f4(x,y,z) (x^y^z)
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30);
|
||||
|
||||
void SHA1::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
/* Copy context->state[] to working vars */
|
||||
word32 a = state[0];
|
||||
word32 b = state[1];
|
||||
word32 c = state[2];
|
||||
word32 d = state[3];
|
||||
word32 e = state[4];
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
|
||||
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
|
||||
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
|
||||
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
|
||||
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
|
||||
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
|
||||
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
|
||||
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
|
||||
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
|
||||
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
|
||||
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
|
||||
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
|
||||
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
|
||||
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
|
||||
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
|
||||
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
}
|
||||
|
||||
// end of Steve Reid's code
|
||||
|
||||
// *************************************************************
|
||||
|
||||
void SHA224::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA256::InitState(HashWordType *state)
|
||||
{
|
||||
static const word32 s[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
CRYPTOPP_ALIGN_DATA(16) extern const word32 SHA256_K[64] CRYPTOPP_SECTION_ALIGN16 = {
|
||||
#else
|
||||
extern const word32 SHA256_K[64] = {
|
||||
#endif
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
|
||||
#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
|
||||
#pragma warning(disable: 4731) // frame pointer register 'ebp' modified by inline assembly code
|
||||
|
||||
static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
||||
, ... // VC60 workaround: prevent VC 6 from inlining this function
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
||||
AS2(mov ecx, [state])
|
||||
AS2(mov edx, [data])
|
||||
#endif
|
||||
|
||||
#define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ
|
||||
#define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4]
|
||||
#define G(i) H(i+1)
|
||||
#define F(i) H(i+2)
|
||||
#define E(i) H(i+3)
|
||||
#define D(i) H(i+4)
|
||||
#define C(i) H(i+5)
|
||||
#define B(i) H(i+6)
|
||||
#define A(i) H(i+7)
|
||||
#define Wt(i) BASE+8*4+ASM_MOD(1024+15-(i),16)*4
|
||||
#define Wt_2(i) Wt((i)-2)
|
||||
#define Wt_15(i) Wt((i)-15)
|
||||
#define Wt_7(i) Wt((i)-7)
|
||||
#define K_END [BASE+8*4+16*4+0*WORD_SZ]
|
||||
#define STATE_SAVE [BASE+8*4+16*4+1*WORD_SZ]
|
||||
#define DATA_SAVE [BASE+8*4+16*4+2*WORD_SZ]
|
||||
#define DATA_END [BASE+8*4+16*4+3*WORD_SZ]
|
||||
#define Kt(i) WORD_REG(si)+(i)*4
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#define BASE esp+4
|
||||
#elif defined(__GNUC__)
|
||||
#define BASE r8
|
||||
#else
|
||||
#define BASE rsp
|
||||
#endif
|
||||
|
||||
#define RA0(i, edx, edi) \
|
||||
AS2( add edx, [Kt(i)] )\
|
||||
AS2( add edx, [Wt(i)] )\
|
||||
AS2( add edx, H(i) )\
|
||||
|
||||
#define RA1(i, edx, edi)
|
||||
|
||||
#define RB0(i, edx, edi)
|
||||
|
||||
#define RB1(i, edx, edi) \
|
||||
AS2( mov AS_REG_7d, [Wt_2(i)] )\
|
||||
AS2( mov edi, [Wt_15(i)])\
|
||||
AS2( mov ebx, AS_REG_7d )\
|
||||
AS2( shr AS_REG_7d, 10 )\
|
||||
AS2( ror ebx, 17 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 2 )\
|
||||
AS2( xor ebx, AS_REG_7d )/* s1(W_t-2) */\
|
||||
AS2( add ebx, [Wt_7(i)])\
|
||||
AS2( mov AS_REG_7d, edi )\
|
||||
AS2( shr AS_REG_7d, 3 )\
|
||||
AS2( ror edi, 7 )\
|
||||
AS2( add ebx, [Wt(i)])/* s1(W_t-2) + W_t-7 + W_t-16 */\
|
||||
AS2( xor AS_REG_7d, edi )\
|
||||
AS2( add edx, [Kt(i)])\
|
||||
AS2( ror edi, 11 )\
|
||||
AS2( add edx, H(i) )\
|
||||
AS2( xor AS_REG_7d, edi )/* s0(W_t-15) */\
|
||||
AS2( add AS_REG_7d, ebx )/* W_t = s1(W_t-2) + W_t-7 + s0(W_t-15) W_t-16*/\
|
||||
AS2( mov [Wt(i)], AS_REG_7d)\
|
||||
AS2( add edx, AS_REG_7d )\
|
||||
|
||||
#define ROUND(i, r, eax, ecx, edi, edx)\
|
||||
/* in: edi = E */\
|
||||
/* unused: eax, ecx, temp: ebx, AS_REG_7d, out: edx = T1 */\
|
||||
AS2( mov edx, F(i) )\
|
||||
AS2( xor edx, G(i) )\
|
||||
AS2( and edx, edi )\
|
||||
AS2( xor edx, G(i) )/* Ch(E,F,G) = (G^(E&(F^G))) */\
|
||||
AS2( mov AS_REG_7d, edi )\
|
||||
AS2( ror edi, 6 )\
|
||||
AS2( ror AS_REG_7d, 25 )\
|
||||
RA##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\
|
||||
AS2( xor AS_REG_7d, edi )\
|
||||
AS2( ror edi, 5 )\
|
||||
AS2( xor AS_REG_7d, edi )/* S1(E) */\
|
||||
AS2( add edx, AS_REG_7d )/* T1 = S1(E) + Ch(E,F,G) + H + Wt + Kt */\
|
||||
RB##r(i, edx, edi )/* H + Wt + Kt + Ch(E,F,G) */\
|
||||
/* in: ecx = A, eax = B^C, edx = T1 */\
|
||||
/* unused: edx, temp: ebx, AS_REG_7d, out: eax = A, ecx = B^C, edx = E */\
|
||||
AS2( mov ebx, ecx )\
|
||||
AS2( xor ecx, B(i) )/* A^B */\
|
||||
AS2( and eax, ecx )\
|
||||
AS2( xor eax, B(i) )/* Maj(A,B,C) = B^((A^B)&(B^C) */\
|
||||
AS2( mov AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 2 )\
|
||||
AS2( add eax, edx )/* T1 + Maj(A,B,C) */\
|
||||
AS2( add edx, D(i) )\
|
||||
AS2( mov D(i), edx )\
|
||||
AS2( ror AS_REG_7d, 22 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( ror ebx, 11 )\
|
||||
AS2( xor AS_REG_7d, ebx )\
|
||||
AS2( add eax, AS_REG_7d )/* T1 + S0(A) + Maj(A,B,C) */\
|
||||
AS2( mov H(i), eax )\
|
||||
|
||||
#define SWAP_COPY(i) \
|
||||
AS2( mov WORD_REG(bx), [WORD_REG(dx)+i*WORD_SZ])\
|
||||
AS1( bswap WORD_REG(bx))\
|
||||
AS2( mov [Wt(i*(1+CRYPTOPP_BOOL_X64)+CRYPTOPP_BOOL_X64)], WORD_REG(bx))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
FixedSizeAlignedSecBlock<byte, LOCALS_SIZE> workspace;
|
||||
#endif
|
||||
__asm__ __volatile__
|
||||
(
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
"lea %4, %%r8;"
|
||||
#endif
|
||||
".intel_syntax noprefix;"
|
||||
#elif defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
ALIGN 8
|
||||
X86_SHA256_HashBlocks PROC FRAME
|
||||
rex_push_reg rsi
|
||||
push_reg rdi
|
||||
push_reg rbx
|
||||
push_reg rbp
|
||||
alloc_stack(LOCALS_SIZE+8)
|
||||
.endprolog
|
||||
mov rdi, r8
|
||||
lea rsi, [?SHA256_K@CryptoPP@@3QBIB + 48*4]
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#ifndef __GNUC__
|
||||
AS2( mov edi, [len])
|
||||
AS2( lea WORD_REG(si), [SHA256_K+48*4])
|
||||
#endif
|
||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
||||
AS_PUSH_IF86(bx)
|
||||
#endif
|
||||
|
||||
AS_PUSH_IF86(bp)
|
||||
AS2( mov ebx, esp)
|
||||
AS2( and esp, -16)
|
||||
AS2( sub WORD_REG(sp), LOCALS_SIZE)
|
||||
AS_PUSH_IF86(bx)
|
||||
#endif
|
||||
AS2( mov STATE_SAVE, WORD_REG(cx))
|
||||
AS2( mov DATA_SAVE, WORD_REG(dx))
|
||||
AS2( add WORD_REG(di), WORD_REG(dx))
|
||||
AS2( mov DATA_END, WORD_REG(di))
|
||||
AS2( mov K_END, WORD_REG(si))
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
AS2( test edi, 1)
|
||||
ASJ( jnz, 2, f)
|
||||
#endif
|
||||
AS2( movdqa xmm0, XMMWORD_PTR [WORD_REG(cx)+0*16])
|
||||
AS2( movdqa xmm1, XMMWORD_PTR [WORD_REG(cx)+1*16])
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASJ( jmp, 0, f)
|
||||
#endif
|
||||
ASL(2) // non-SSE2
|
||||
AS2( mov esi, ecx)
|
||||
AS2( lea edi, A(0))
|
||||
AS2( mov ecx, 8)
|
||||
AS1( rep movsd)
|
||||
AS2( mov esi, K_END)
|
||||
ASJ( jmp, 3, f)
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASL(0)
|
||||
AS2( movdqa E(0), xmm1)
|
||||
AS2( movdqa A(0), xmm0)
|
||||
#endif
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
ASL(3)
|
||||
#endif
|
||||
AS2( sub WORD_REG(si), 48*4)
|
||||
SWAP_COPY(0) SWAP_COPY(1) SWAP_COPY(2) SWAP_COPY(3)
|
||||
SWAP_COPY(4) SWAP_COPY(5) SWAP_COPY(6) SWAP_COPY(7)
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
SWAP_COPY(8) SWAP_COPY(9) SWAP_COPY(10) SWAP_COPY(11)
|
||||
SWAP_COPY(12) SWAP_COPY(13) SWAP_COPY(14) SWAP_COPY(15)
|
||||
#endif
|
||||
AS2( mov edi, E(0)) // E
|
||||
AS2( mov eax, B(0)) // B
|
||||
AS2( xor eax, C(0)) // B^C
|
||||
AS2( mov ecx, A(0)) // A
|
||||
|
||||
ROUND(0, 0, eax, ecx, edi, edx)
|
||||
ROUND(1, 0, ecx, eax, edx, edi)
|
||||
ROUND(2, 0, eax, ecx, edi, edx)
|
||||
ROUND(3, 0, ecx, eax, edx, edi)
|
||||
ROUND(4, 0, eax, ecx, edi, edx)
|
||||
ROUND(5, 0, ecx, eax, edx, edi)
|
||||
ROUND(6, 0, eax, ecx, edi, edx)
|
||||
ROUND(7, 0, ecx, eax, edx, edi)
|
||||
ROUND(8, 0, eax, ecx, edi, edx)
|
||||
ROUND(9, 0, ecx, eax, edx, edi)
|
||||
ROUND(10, 0, eax, ecx, edi, edx)
|
||||
ROUND(11, 0, ecx, eax, edx, edi)
|
||||
ROUND(12, 0, eax, ecx, edi, edx)
|
||||
ROUND(13, 0, ecx, eax, edx, edi)
|
||||
ROUND(14, 0, eax, ecx, edi, edx)
|
||||
ROUND(15, 0, ecx, eax, edx, edi)
|
||||
|
||||
ASL(1)
|
||||
AS2(add WORD_REG(si), 4*16)
|
||||
ROUND(0, 1, eax, ecx, edi, edx)
|
||||
ROUND(1, 1, ecx, eax, edx, edi)
|
||||
ROUND(2, 1, eax, ecx, edi, edx)
|
||||
ROUND(3, 1, ecx, eax, edx, edi)
|
||||
ROUND(4, 1, eax, ecx, edi, edx)
|
||||
ROUND(5, 1, ecx, eax, edx, edi)
|
||||
ROUND(6, 1, eax, ecx, edi, edx)
|
||||
ROUND(7, 1, ecx, eax, edx, edi)
|
||||
ROUND(8, 1, eax, ecx, edi, edx)
|
||||
ROUND(9, 1, ecx, eax, edx, edi)
|
||||
ROUND(10, 1, eax, ecx, edi, edx)
|
||||
ROUND(11, 1, ecx, eax, edx, edi)
|
||||
ROUND(12, 1, eax, ecx, edi, edx)
|
||||
ROUND(13, 1, ecx, eax, edx, edi)
|
||||
ROUND(14, 1, eax, ecx, edi, edx)
|
||||
ROUND(15, 1, ecx, eax, edx, edi)
|
||||
AS2( cmp WORD_REG(si), K_END)
|
||||
ASJ( jne, 1, b)
|
||||
|
||||
AS2( mov WORD_REG(dx), DATA_SAVE)
|
||||
AS2( add WORD_REG(dx), 64)
|
||||
AS2( mov AS_REG_7, STATE_SAVE)
|
||||
AS2( mov DATA_SAVE, WORD_REG(dx))
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
AS2( test DWORD PTR DATA_END, 1)
|
||||
ASJ( jnz, 4, f)
|
||||
#endif
|
||||
AS2( movdqa xmm1, XMMWORD_PTR [AS_REG_7+1*16])
|
||||
AS2( movdqa xmm0, XMMWORD_PTR [AS_REG_7+0*16])
|
||||
AS2( paddd xmm1, E(0))
|
||||
AS2( paddd xmm0, A(0))
|
||||
AS2( movdqa [AS_REG_7+1*16], xmm1)
|
||||
AS2( movdqa [AS_REG_7+0*16], xmm0)
|
||||
AS2( cmp WORD_REG(dx), DATA_END)
|
||||
ASJ( jl, 0, b)
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASJ( jmp, 5, f)
|
||||
ASL(4) // non-SSE2
|
||||
#endif
|
||||
AS2( add [AS_REG_7+0*4], ecx) // A
|
||||
AS2( add [AS_REG_7+4*4], edi) // E
|
||||
AS2( mov eax, B(0))
|
||||
AS2( mov ebx, C(0))
|
||||
AS2( mov ecx, D(0))
|
||||
AS2( add [AS_REG_7+1*4], eax)
|
||||
AS2( add [AS_REG_7+2*4], ebx)
|
||||
AS2( add [AS_REG_7+3*4], ecx)
|
||||
AS2( mov eax, F(0))
|
||||
AS2( mov ebx, G(0))
|
||||
AS2( mov ecx, H(0))
|
||||
AS2( add [AS_REG_7+5*4], eax)
|
||||
AS2( add [AS_REG_7+6*4], ebx)
|
||||
AS2( add [AS_REG_7+7*4], ecx)
|
||||
AS2( mov ecx, AS_REG_7d)
|
||||
AS2( cmp WORD_REG(dx), DATA_END)
|
||||
ASJ( jl, 2, b)
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
ASL(5)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
AS_POP_IF86(sp)
|
||||
AS_POP_IF86(bp)
|
||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
||||
AS_POP_IF86(bx)
|
||||
#endif
|
||||
|
||||
#ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
add rsp, LOCALS_SIZE+8
|
||||
pop rbp
|
||||
pop rbx
|
||||
pop rdi
|
||||
pop rsi
|
||||
ret
|
||||
X86_SHA256_HashBlocks ENDP
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
".att_syntax prefix;"
|
||||
:
|
||||
: "c" (state), "d" (data), "S" (SHA256_K+48), "D" (len)
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
, "m" (workspace[0])
|
||||
#endif
|
||||
: "memory", "cc", "%eax"
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
, "%rbx", "%r8"
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
|
||||
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
|
||||
extern "C" {
|
||||
void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(word32 *state, const word32 *data, size_t len);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
|
||||
size_t SHA256::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
||||
return length % BLOCKSIZE;
|
||||
}
|
||||
|
||||
size_t SHA224::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
X86_SHA256_HashBlocks(m_state, input, (length&(size_t(0)-BLOCKSIZE)) - !HasSSE2());
|
||||
return length % BLOCKSIZE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
|
||||
|
||||
#define Ch(x,y,z) (z^(x&(y^z)))
|
||||
#define Maj(x,y,z) (y^((x^y)&(y^z)))
|
||||
|
||||
#define a(i) T[(0-i)&7]
|
||||
#define b(i) T[(1-i)&7]
|
||||
#define c(i) T[(2-i)&7]
|
||||
#define d(i) T[(3-i)&7]
|
||||
#define e(i) T[(4-i)&7]
|
||||
#define f(i) T[(5-i)&7]
|
||||
#define g(i) T[(6-i)&7]
|
||||
#define h(i) T[(7-i)&7]
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
// for SHA256
|
||||
#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
|
||||
#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
|
||||
#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
|
||||
#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
|
||||
|
||||
void SHA256::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 W[16];
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
// this byte reverse is a waste of time, but this function is only called by MDC
|
||||
ByteReverse(W, data, BLOCKSIZE);
|
||||
X86_SHA256_HashBlocks(state, W, BLOCKSIZE - !HasSSE2());
|
||||
#else
|
||||
word32 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 64 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<64; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
// smaller but slower
|
||||
void SHA256::Transform(word32 *state, const word32 *data)
|
||||
{
|
||||
word32 T[20];
|
||||
word32 W[32];
|
||||
unsigned int i = 0, j = 0;
|
||||
word32 *t = T+8;
|
||||
|
||||
memcpy(t, state, 8*4);
|
||||
word32 e = t[4], a = t[0];
|
||||
|
||||
do
|
||||
{
|
||||
word32 w = data[j];
|
||||
W[j] = w;
|
||||
w += SHA256_K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
--t;
|
||||
++j;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<16);
|
||||
|
||||
do
|
||||
{
|
||||
i = j&0xf;
|
||||
word32 w = s1(W[i+16-2]) + s0(W[i+16-15]) + W[i] + W[i+16-7];
|
||||
W[i+16] = W[i] = w;
|
||||
w += SHA256_K[j];
|
||||
w += t[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, t[5], t[6]);
|
||||
e = t[3] + w;
|
||||
t[3] = t[3+8] = e;
|
||||
w += S0(t[0]);
|
||||
a = w + Maj(a, t[1], t[2]);
|
||||
t[-1] = t[7] = a;
|
||||
|
||||
w = s1(W[(i+1)+16-2]) + s0(W[(i+1)+16-15]) + W[(i+1)] + W[(i+1)+16-7];
|
||||
W[(i+1)+16] = W[(i+1)] = w;
|
||||
w += SHA256_K[j+1];
|
||||
w += (t-1)[7];
|
||||
w += S1(e);
|
||||
w += Ch(e, (t-1)[5], (t-1)[6]);
|
||||
e = (t-1)[3] + w;
|
||||
(t-1)[3] = (t-1)[3+8] = e;
|
||||
w += S0((t-1)[0]);
|
||||
a = w + Maj(a, (t-1)[1], (t-1)[2]);
|
||||
(t-1)[-1] = (t-1)[7] = a;
|
||||
|
||||
t-=2;
|
||||
j+=2;
|
||||
if (j%8 == 0)
|
||||
t += 8;
|
||||
} while (j<64);
|
||||
|
||||
state[0] += a;
|
||||
state[1] += t[1];
|
||||
state[2] += t[2];
|
||||
state[3] += t[3];
|
||||
state[4] += e;
|
||||
state[5] += t[5];
|
||||
state[6] += t[6];
|
||||
state[7] += t[7];
|
||||
}
|
||||
*/
|
||||
|
||||
#undef S0
|
||||
#undef S1
|
||||
#undef s0
|
||||
#undef s1
|
||||
#undef R
|
||||
|
||||
// *************************************************************
|
||||
|
||||
void SHA384::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0xcbbb9d5dc1059ed8), W64LIT(0x629a292a367cd507),
|
||||
W64LIT(0x9159015a3070dd17), W64LIT(0x152fecd8f70e5939),
|
||||
W64LIT(0x67332667ffc00b31), W64LIT(0x8eb44a8768581511),
|
||||
W64LIT(0xdb0c2e0d64f98fa7), W64LIT(0x47b5481dbefa4fa4)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
void SHA512::InitState(HashWordType *state)
|
||||
{
|
||||
static const word64 s[8] = {
|
||||
W64LIT(0x6a09e667f3bcc908), W64LIT(0xbb67ae8584caa73b),
|
||||
W64LIT(0x3c6ef372fe94f82b), W64LIT(0xa54ff53a5f1d36f1),
|
||||
W64LIT(0x510e527fade682d1), W64LIT(0x9b05688c2b3e6c1f),
|
||||
W64LIT(0x1f83d9abfb41bd6b), W64LIT(0x5be0cd19137e2179)};
|
||||
memcpy(state, s, sizeof(s));
|
||||
}
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
CRYPTOPP_ALIGN_DATA(16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16 = {
|
||||
#else
|
||||
static const word64 SHA512_K[80] = {
|
||||
#endif
|
||||
W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
|
||||
W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
|
||||
W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
|
||||
W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
|
||||
W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
|
||||
W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
|
||||
W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
|
||||
W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
|
||||
W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
|
||||
W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
|
||||
W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
|
||||
W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
|
||||
W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
|
||||
W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
|
||||
W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
|
||||
W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
|
||||
W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
|
||||
W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
|
||||
W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
|
||||
W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
|
||||
W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
|
||||
W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
|
||||
W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
|
||||
W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
|
||||
W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
|
||||
W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
|
||||
W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
|
||||
W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
|
||||
W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
|
||||
W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
|
||||
W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
|
||||
W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
|
||||
W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
|
||||
W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
|
||||
W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
|
||||
W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
|
||||
W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
|
||||
W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
|
||||
W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
|
||||
W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
|
||||
};
|
||||
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
// put assembly version in separate function, otherwise MSVC 2005 SP1 doesn't generate correct code for the non-assembly version
|
||||
CRYPTOPP_NAKED static void CRYPTOPP_FASTCALL SHA512_SSE2_Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__
|
||||
(
|
||||
".intel_syntax noprefix;"
|
||||
AS1( push ebx)
|
||||
AS2( mov ebx, eax)
|
||||
#else
|
||||
AS1( push ebx)
|
||||
AS1( push esi)
|
||||
AS1( push edi)
|
||||
AS2( lea ebx, SHA512_K)
|
||||
#endif
|
||||
|
||||
AS2( mov eax, esp)
|
||||
AS2( and esp, 0xfffffff0)
|
||||
AS2( sub esp, 27*16) // 17*16 for expanded data, 20*8 for state
|
||||
AS1( push eax)
|
||||
AS2( xor eax, eax)
|
||||
AS2( lea edi, [esp+4+8*8]) // start at middle of state buffer. will decrement pointer each round to avoid copying
|
||||
AS2( lea esi, [esp+4+20*8+8]) // 16-byte alignment, then add 8
|
||||
|
||||
AS2( movdqa xmm0, [ecx+0*16])
|
||||
AS2( movdq2q mm4, xmm0)
|
||||
AS2( movdqa [edi+0*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+1*16])
|
||||
AS2( movdqa [edi+1*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+2*16])
|
||||
AS2( movdq2q mm5, xmm0)
|
||||
AS2( movdqa [edi+2*16], xmm0)
|
||||
AS2( movdqa xmm0, [ecx+3*16])
|
||||
AS2( movdqa [edi+3*16], xmm0)
|
||||
ASJ( jmp, 0, f)
|
||||
|
||||
#define SSE2_S0_S1(r, a, b, c) \
|
||||
AS2( movq mm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movq mm7, r)\
|
||||
AS2( psllq mm6, 64-c)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor mm7, r)\
|
||||
AS2( psllq mm6, c-b)\
|
||||
AS2( pxor mm7, mm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, mm7)\
|
||||
AS2( psllq mm6, b-a)\
|
||||
AS2( pxor r, mm6)
|
||||
|
||||
#define SSE2_s0(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)\
|
||||
AS2( psllq xmm6, c-a)\
|
||||
AS2( pxor r, xmm6)
|
||||
|
||||
#define SSE2_s1(r, a, b, c) \
|
||||
AS2( movdqa xmm6, r)\
|
||||
AS2( psrlq r, a)\
|
||||
AS2( movdqa xmm7, r)\
|
||||
AS2( psllq xmm6, 64-c)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, b-a)\
|
||||
AS2( pxor xmm7, r)\
|
||||
AS2( psllq xmm6, c-b)\
|
||||
AS2( pxor xmm7, xmm6)\
|
||||
AS2( psrlq r, c-b)\
|
||||
AS2( pxor r, xmm7)
|
||||
|
||||
ASL(SHA512_Round)
|
||||
// k + w is in mm0, a is in mm4, e is in mm5
|
||||
AS2( paddq mm0, [edi+7*8]) // h
|
||||
AS2( movq mm2, [edi+5*8]) // f
|
||||
AS2( movq mm3, [edi+6*8]) // g
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( pand mm2, mm5)
|
||||
SSE2_S0_S1(mm5,14,18,41)
|
||||
AS2( pxor mm2, mm3)
|
||||
AS2( paddq mm0, mm2) // h += Ch(e,f,g)
|
||||
AS2( paddq mm5, mm0) // h += S1(e)
|
||||
AS2( movq mm2, [edi+1*8]) // b
|
||||
AS2( movq mm1, mm2)
|
||||
AS2( por mm2, mm4)
|
||||
AS2( pand mm2, [edi+2*8]) // c
|
||||
AS2( pand mm1, mm4)
|
||||
AS2( por mm1, mm2)
|
||||
AS2( paddq mm1, mm5) // temp = h + Maj(a,b,c)
|
||||
AS2( paddq mm5, [edi+3*8]) // e = d + h
|
||||
AS2( movq [edi+3*8], mm5)
|
||||
AS2( movq [edi+11*8], mm5)
|
||||
SSE2_S0_S1(mm4,28,34,39) // S0(a)
|
||||
AS2( paddq mm4, mm1) // a = temp + S0(a)
|
||||
AS2( movq [edi-8], mm4)
|
||||
AS2( movq [edi+7*8], mm4)
|
||||
AS1( ret)
|
||||
|
||||
// first 16 rounds
|
||||
ASL(0)
|
||||
AS2( movq mm0, [edx+eax*8])
|
||||
AS2( movq [esi+eax*8], mm0)
|
||||
AS2( movq [esi+eax*8+16*8], mm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
ASC( call, SHA512_Round)
|
||||
AS1( inc eax)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 0, b)
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 16)
|
||||
ASJ( jne, 0, b)
|
||||
|
||||
// rest of the rounds
|
||||
AS2( movdqu xmm0, [esi+(16-2)*8])
|
||||
ASL(1)
|
||||
// data expansion, W[i-2] already in xmm0
|
||||
AS2( movdqu xmm3, [esi])
|
||||
AS2( paddq xmm3, [esi+(16-7)*8])
|
||||
AS2( movdqa xmm2, [esi+(16-15)*8])
|
||||
SSE2_s1(xmm0, 6, 19, 61)
|
||||
AS2( paddq xmm0, xmm3)
|
||||
SSE2_s0(xmm2, 1, 7, 8)
|
||||
AS2( paddq xmm0, xmm2)
|
||||
AS2( movdq2q mm0, xmm0)
|
||||
AS2( movhlps xmm1, xmm0)
|
||||
AS2( paddq mm0, [ebx+eax*8])
|
||||
AS2( movlps [esi], xmm0)
|
||||
AS2( movlps [esi+8], xmm1)
|
||||
AS2( movlps [esi+8*16], xmm0)
|
||||
AS2( movlps [esi+8*17], xmm1)
|
||||
// 2 rounds
|
||||
ASC( call, SHA512_Round)
|
||||
AS2( sub edi, 8)
|
||||
AS2( movdq2q mm0, xmm1)
|
||||
AS2( paddq mm0, [ebx+eax*8+8])
|
||||
ASC( call, SHA512_Round)
|
||||
// update indices and loop
|
||||
AS2( add esi, 16)
|
||||
AS2( add eax, 2)
|
||||
AS2( sub edi, 8)
|
||||
AS2( test eax, 7)
|
||||
ASJ( jnz, 1, b)
|
||||
// do housekeeping every 8 rounds
|
||||
AS2( mov esi, 0xf)
|
||||
AS2( and esi, eax)
|
||||
AS2( lea esi, [esp+4+20*8+8+esi*8])
|
||||
AS2( add edi, 8*8)
|
||||
AS2( cmp eax, 80)
|
||||
ASJ( jne, 1, b)
|
||||
|
||||
#define SSE2_CombineState(i) \
|
||||
AS2( movdqa xmm0, [edi+i*16])\
|
||||
AS2( paddq xmm0, [ecx+i*16])\
|
||||
AS2( movdqa [ecx+i*16], xmm0)
|
||||
|
||||
SSE2_CombineState(0)
|
||||
SSE2_CombineState(1)
|
||||
SSE2_CombineState(2)
|
||||
SSE2_CombineState(3)
|
||||
|
||||
AS1( pop esp)
|
||||
AS1( emms)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
AS1( pop ebx)
|
||||
".att_syntax prefix;"
|
||||
:
|
||||
: "a" (SHA512_K), "c" (state), "d" (data)
|
||||
: "%esi", "%edi", "memory", "cc"
|
||||
);
|
||||
#else
|
||||
AS1( pop edi)
|
||||
AS1( pop esi)
|
||||
AS1( pop ebx)
|
||||
AS1( ret)
|
||||
#endif
|
||||
}
|
||||
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||
|
||||
void SHA512::Transform(word64 *state, const word64 *data)
|
||||
{
|
||||
#if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE && CRYPTOPP_BOOL_X86
|
||||
if (HasSSE2())
|
||||
{
|
||||
SHA512_SSE2_Transform(state, data);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
|
||||
#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
|
||||
#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
|
||||
#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
|
||||
|
||||
#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA512_K[i+j]+(j?blk2(i):blk0(i));\
|
||||
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
|
||||
|
||||
word64 W[16];
|
||||
word64 T[8];
|
||||
/* Copy context->state[] to working vars */
|
||||
memcpy(T, state, sizeof(T));
|
||||
/* 80 operations, partially loop unrolled */
|
||||
for (unsigned int j=0; j<80; j+=16)
|
||||
{
|
||||
R( 0); R( 1); R( 2); R( 3);
|
||||
R( 4); R( 5); R( 6); R( 7);
|
||||
R( 8); R( 9); R(10); R(11);
|
||||
R(12); R(13); R(14); R(15);
|
||||
}
|
||||
/* Add the working vars back into context.state[] */
|
||||
state[0] += a(0);
|
||||
state[1] += b(0);
|
||||
state[2] += c(0);
|
||||
state[3] += d(0);
|
||||
state[4] += e(0);
|
||||
state[5] += f(0);
|
||||
state[6] += g(0);
|
||||
state[7] += h(0);
|
||||
}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif // #ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||
#endif // #ifndef CRYPTOPP_IMPORTS
|
||||
63
src/cryptopp/sha.h
Normal file
63
src/cryptopp/sha.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef CRYPTOPP_SHA_H
|
||||
#define CRYPTOPP_SHA_H
|
||||
|
||||
#include "iterhash.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
/// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
|
||||
class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
|
||||
};
|
||||
|
||||
typedef SHA1 SHA; // for backwards compatibility
|
||||
|
||||
//! implements the SHA-256 standard
|
||||
class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
|
||||
{
|
||||
public:
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
size_t HashMultipleBlocks(const word32 *input, size_t length);
|
||||
#endif
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
|
||||
};
|
||||
|
||||
//! implements the SHA-224 standard
|
||||
class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
|
||||
{
|
||||
public:
|
||||
#if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
|
||||
size_t HashMultipleBlocks(const word32 *input, size_t length);
|
||||
#endif
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
|
||||
};
|
||||
|
||||
//! implements the SHA-512 standard
|
||||
class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, CRYPTOPP_BOOL_X86>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
|
||||
};
|
||||
|
||||
//! implements the SHA-384 standard
|
||||
class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, CRYPTOPP_BOOL_X86>
|
||||
{
|
||||
public:
|
||||
static void CRYPTOPP_API InitState(HashWordType *state);
|
||||
static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
|
||||
static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1
src/cryptopp/simple.h
Normal file
1
src/cryptopp/simple.h
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
223
src/cryptopp/smartptr.h
Normal file
223
src/cryptopp/smartptr.h
Normal file
@@ -0,0 +1,223 @@
|
||||
#ifndef CRYPTOPP_SMARTPTR_H
|
||||
#define CRYPTOPP_SMARTPTR_H
|
||||
|
||||
#include "config.h"
|
||||
#include <algorithm>
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
template <class T> class simple_ptr
|
||||
{
|
||||
public:
|
||||
simple_ptr() : m_p(NULL) {}
|
||||
~simple_ptr() {delete m_p;}
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> class member_ptr
|
||||
{
|
||||
public:
|
||||
explicit member_ptr(T *p = NULL) : m_p(p) {}
|
||||
|
||||
~member_ptr();
|
||||
|
||||
const T& operator*() const { return *m_p; }
|
||||
T& operator*() { return *m_p; }
|
||||
|
||||
const T* operator->() const { return m_p; }
|
||||
T* operator->() { return m_p; }
|
||||
|
||||
const T* get() const { return m_p; }
|
||||
T* get() { return m_p; }
|
||||
|
||||
T* release()
|
||||
{
|
||||
T *old_p = m_p;
|
||||
m_p = 0;
|
||||
return old_p;
|
||||
}
|
||||
|
||||
void reset(T *p = 0);
|
||||
|
||||
protected:
|
||||
member_ptr(const member_ptr<T>& rhs); // copy not allowed
|
||||
void operator=(const member_ptr<T>& rhs); // assignment not allowed
|
||||
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> member_ptr<T>::~member_ptr() {delete m_p;}
|
||||
template <class T> void member_ptr<T>::reset(T *p) {delete m_p; m_p = p;}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class value_ptr : public member_ptr<T>
|
||||
{
|
||||
public:
|
||||
value_ptr(const T &obj) : member_ptr<T>(new T(obj)) {}
|
||||
value_ptr(T *p = NULL) : member_ptr<T>(p) {}
|
||||
value_ptr(const value_ptr<T>& rhs)
|
||||
: member_ptr<T>(rhs.m_p ? new T(*rhs.m_p) : NULL) {}
|
||||
|
||||
value_ptr<T>& operator=(const value_ptr<T>& rhs);
|
||||
bool operator==(const value_ptr<T>& rhs)
|
||||
{
|
||||
return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
|
||||
{
|
||||
T *old_p = this->m_p;
|
||||
this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
|
||||
delete old_p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class clonable_ptr : public member_ptr<T>
|
||||
{
|
||||
public:
|
||||
clonable_ptr(const T &obj) : member_ptr<T>(obj.Clone()) {}
|
||||
clonable_ptr(T *p = NULL) : member_ptr<T>(p) {}
|
||||
clonable_ptr(const clonable_ptr<T>& rhs)
|
||||
: member_ptr<T>(rhs.m_p ? rhs.m_p->Clone() : NULL) {}
|
||||
|
||||
clonable_ptr<T>& operator=(const clonable_ptr<T>& rhs);
|
||||
};
|
||||
|
||||
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
|
||||
{
|
||||
T *old_p = this->m_p;
|
||||
this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
|
||||
delete old_p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template<class T> class counted_ptr
|
||||
{
|
||||
public:
|
||||
explicit counted_ptr(T *p = 0);
|
||||
counted_ptr(const T &r) : m_p(0) {attach(r);}
|
||||
counted_ptr(const counted_ptr<T>& rhs);
|
||||
|
||||
~counted_ptr();
|
||||
|
||||
const T& operator*() const { return *m_p; }
|
||||
T& operator*() { return *m_p; }
|
||||
|
||||
const T* operator->() const { return m_p; }
|
||||
T* operator->() { return get(); }
|
||||
|
||||
const T* get() const { return m_p; }
|
||||
T* get();
|
||||
|
||||
void attach(const T &p);
|
||||
|
||||
counted_ptr<T> & operator=(const counted_ptr<T>& rhs);
|
||||
|
||||
private:
|
||||
T *m_p;
|
||||
};
|
||||
|
||||
template <class T> counted_ptr<T>::counted_ptr(T *p)
|
||||
: m_p(p)
|
||||
{
|
||||
if (m_p)
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T>::counted_ptr(const counted_ptr<T>& rhs)
|
||||
: m_p(rhs.m_p)
|
||||
{
|
||||
if (m_p)
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T>::~counted_ptr()
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
}
|
||||
|
||||
template <class T> void counted_ptr<T>::attach(const T &r)
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
if (r.m_referenceCount == 0)
|
||||
{
|
||||
m_p = r.clone();
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_p = const_cast<T *>(&r);
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T> T* counted_ptr<T>::get()
|
||||
{
|
||||
if (m_p && m_p->m_referenceCount > 1)
|
||||
{
|
||||
T *temp = m_p->clone();
|
||||
m_p->m_referenceCount--;
|
||||
m_p = temp;
|
||||
m_p->m_referenceCount = 1;
|
||||
}
|
||||
return m_p;
|
||||
}
|
||||
|
||||
template <class T> counted_ptr<T> & counted_ptr<T>::operator=(const counted_ptr<T>& rhs)
|
||||
{
|
||||
if (m_p != rhs.m_p)
|
||||
{
|
||||
if (m_p && --m_p->m_referenceCount == 0)
|
||||
delete m_p;
|
||||
m_p = rhs.m_p;
|
||||
if (m_p)
|
||||
m_p->m_referenceCount++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
template <class T> class vector_member_ptrs
|
||||
{
|
||||
public:
|
||||
vector_member_ptrs(size_t size=0)
|
||||
: m_size(size), m_ptr(new member_ptr<T>[size]) {}
|
||||
~vector_member_ptrs()
|
||||
{delete [] this->m_ptr;}
|
||||
|
||||
member_ptr<T>& operator[](size_t index)
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
const member_ptr<T>& operator[](size_t index) const
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
|
||||
size_t size() const {return this->m_size;}
|
||||
void resize(size_t newSize)
|
||||
{
|
||||
member_ptr<T> *newPtr = new member_ptr<T>[newSize];
|
||||
for (size_t i=0; i<this->m_size && i<newSize; i++)
|
||||
newPtr[i].reset(this->m_ptr[i].release());
|
||||
delete [] this->m_ptr;
|
||||
this->m_size = newSize;
|
||||
this->m_ptr = newPtr;
|
||||
}
|
||||
|
||||
private:
|
||||
vector_member_ptrs(const vector_member_ptrs<T> &c); // copy not allowed
|
||||
void operator=(const vector_member_ptrs<T> &x); // assignment not allowed
|
||||
|
||||
size_t m_size;
|
||||
member_ptr<T> *m_ptr;
|
||||
};
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
27
src/cryptopp/stdcpp.h
Normal file
27
src/cryptopp/stdcpp.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef CRYPTOPP_STDCPP_H
|
||||
#define CRYPTOPP_STDCPP_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <string.h> // CodeWarrior doesn't have memory.h
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
// re-disable this
|
||||
#pragma warning(disable: 4231)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_CRTAPI1)
|
||||
#define CRYPTOPP_MSVCRT6
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1023
src/db.cpp
Normal file
1023
src/db.cpp
Normal file
File diff suppressed because it is too large
Load Diff
514
src/db.h
Normal file
514
src/db.h
Normal file
@@ -0,0 +1,514 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
class CTransaction;
|
||||
class CTxIndex;
|
||||
class CDiskBlockIndex;
|
||||
class CDiskTxPos;
|
||||
class COutPoint;
|
||||
class CUser;
|
||||
class CReview;
|
||||
class CAddress;
|
||||
class CWalletTx;
|
||||
class CAccount;
|
||||
class CAccountingEntry;
|
||||
class CBlockLocator;
|
||||
|
||||
extern map<string, string> mapAddressBook;
|
||||
extern CCriticalSection cs_mapAddressBook;
|
||||
extern vector<unsigned char> vchDefaultKey;
|
||||
extern bool fClient;
|
||||
extern int nBestHeight;
|
||||
|
||||
|
||||
extern unsigned int nWalletDBUpdated;
|
||||
extern DbEnv dbenv;
|
||||
|
||||
|
||||
extern void DBFlush(bool fShutdown);
|
||||
extern vector<unsigned char> GetKeyFromKeyPool();
|
||||
extern int64 GetOldestKeyPoolTime();
|
||||
|
||||
|
||||
|
||||
|
||||
class CDB
|
||||
{
|
||||
protected:
|
||||
Db* pdb;
|
||||
string strFile;
|
||||
vector<DbTxn*> vTxn;
|
||||
bool fReadOnly;
|
||||
|
||||
explicit CDB(const char* pszFile, const char* pszMode="r+");
|
||||
~CDB() { Close(); }
|
||||
public:
|
||||
void Close();
|
||||
private:
|
||||
CDB(const CDB&);
|
||||
void operator=(const CDB&);
|
||||
|
||||
protected:
|
||||
template<typename K, typename T>
|
||||
bool Read(const K& key, T& value)
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
|
||||
// Key
|
||||
CDataStream ssKey(SER_DISK);
|
||||
ssKey.reserve(1000);
|
||||
ssKey << key;
|
||||
Dbt datKey(&ssKey[0], ssKey.size());
|
||||
|
||||
// Read
|
||||
Dbt datValue;
|
||||
datValue.set_flags(DB_DBT_MALLOC);
|
||||
int ret = pdb->get(GetTxn(), &datKey, &datValue, 0);
|
||||
memset(datKey.get_data(), 0, datKey.get_size());
|
||||
if (datValue.get_data() == NULL)
|
||||
return false;
|
||||
|
||||
// Unserialize value
|
||||
CDataStream ssValue((char*)datValue.get_data(), (char*)datValue.get_data() + datValue.get_size(), SER_DISK);
|
||||
ssValue >> value;
|
||||
|
||||
// Clear and free memory
|
||||
memset(datValue.get_data(), 0, datValue.get_size());
|
||||
free(datValue.get_data());
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
template<typename K, typename T>
|
||||
bool Write(const K& key, const T& value, bool fOverwrite=true)
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
if (fReadOnly)
|
||||
assert(("Write called on database in read-only mode", false));
|
||||
|
||||
// Key
|
||||
CDataStream ssKey(SER_DISK);
|
||||
ssKey.reserve(1000);
|
||||
ssKey << key;
|
||||
Dbt datKey(&ssKey[0], ssKey.size());
|
||||
|
||||
// Value
|
||||
CDataStream ssValue(SER_DISK);
|
||||
ssValue.reserve(10000);
|
||||
ssValue << value;
|
||||
Dbt datValue(&ssValue[0], ssValue.size());
|
||||
|
||||
// Write
|
||||
int ret = pdb->put(GetTxn(), &datKey, &datValue, (fOverwrite ? 0 : DB_NOOVERWRITE));
|
||||
|
||||
// Clear memory in case it was a private key
|
||||
memset(datKey.get_data(), 0, datKey.get_size());
|
||||
memset(datValue.get_data(), 0, datValue.get_size());
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
template<typename K>
|
||||
bool Erase(const K& key)
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
if (fReadOnly)
|
||||
assert(("Erase called on database in read-only mode", false));
|
||||
|
||||
// Key
|
||||
CDataStream ssKey(SER_DISK);
|
||||
ssKey.reserve(1000);
|
||||
ssKey << key;
|
||||
Dbt datKey(&ssKey[0], ssKey.size());
|
||||
|
||||
// Erase
|
||||
int ret = pdb->del(GetTxn(), &datKey, 0);
|
||||
|
||||
// Clear memory
|
||||
memset(datKey.get_data(), 0, datKey.get_size());
|
||||
return (ret == 0 || ret == DB_NOTFOUND);
|
||||
}
|
||||
|
||||
template<typename K>
|
||||
bool Exists(const K& key)
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
|
||||
// Key
|
||||
CDataStream ssKey(SER_DISK);
|
||||
ssKey.reserve(1000);
|
||||
ssKey << key;
|
||||
Dbt datKey(&ssKey[0], ssKey.size());
|
||||
|
||||
// Exists
|
||||
int ret = pdb->exists(GetTxn(), &datKey, 0);
|
||||
|
||||
// Clear memory
|
||||
memset(datKey.get_data(), 0, datKey.get_size());
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
Dbc* GetCursor()
|
||||
{
|
||||
if (!pdb)
|
||||
return NULL;
|
||||
Dbc* pcursor = NULL;
|
||||
int ret = pdb->cursor(NULL, &pcursor, 0);
|
||||
if (ret != 0)
|
||||
return NULL;
|
||||
return pcursor;
|
||||
}
|
||||
|
||||
int ReadAtCursor(Dbc* pcursor, CDataStream& ssKey, CDataStream& ssValue, unsigned int fFlags=DB_NEXT)
|
||||
{
|
||||
// Read at cursor
|
||||
Dbt datKey;
|
||||
if (fFlags == DB_SET || fFlags == DB_SET_RANGE || fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
|
||||
{
|
||||
datKey.set_data(&ssKey[0]);
|
||||
datKey.set_size(ssKey.size());
|
||||
}
|
||||
Dbt datValue;
|
||||
if (fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
|
||||
{
|
||||
datValue.set_data(&ssValue[0]);
|
||||
datValue.set_size(ssValue.size());
|
||||
}
|
||||
datKey.set_flags(DB_DBT_MALLOC);
|
||||
datValue.set_flags(DB_DBT_MALLOC);
|
||||
int ret = pcursor->get(&datKey, &datValue, fFlags);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
else if (datKey.get_data() == NULL || datValue.get_data() == NULL)
|
||||
return 99999;
|
||||
|
||||
// Convert to streams
|
||||
ssKey.SetType(SER_DISK);
|
||||
ssKey.clear();
|
||||
ssKey.write((char*)datKey.get_data(), datKey.get_size());
|
||||
ssValue.SetType(SER_DISK);
|
||||
ssValue.clear();
|
||||
ssValue.write((char*)datValue.get_data(), datValue.get_size());
|
||||
|
||||
// Clear and free memory
|
||||
memset(datKey.get_data(), 0, datKey.get_size());
|
||||
memset(datValue.get_data(), 0, datValue.get_size());
|
||||
free(datKey.get_data());
|
||||
free(datValue.get_data());
|
||||
return 0;
|
||||
}
|
||||
|
||||
DbTxn* GetTxn()
|
||||
{
|
||||
if (!vTxn.empty())
|
||||
return vTxn.back();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public:
|
||||
bool TxnBegin()
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
DbTxn* ptxn = NULL;
|
||||
int ret = dbenv.txn_begin(GetTxn(), &ptxn, DB_TXN_NOSYNC);
|
||||
if (!ptxn || ret != 0)
|
||||
return false;
|
||||
vTxn.push_back(ptxn);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TxnCommit()
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
if (vTxn.empty())
|
||||
return false;
|
||||
int ret = vTxn.back()->commit(0);
|
||||
vTxn.pop_back();
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
bool TxnAbort()
|
||||
{
|
||||
if (!pdb)
|
||||
return false;
|
||||
if (vTxn.empty())
|
||||
return false;
|
||||
int ret = vTxn.back()->abort();
|
||||
vTxn.pop_back();
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
bool ReadVersion(int& nVersion)
|
||||
{
|
||||
nVersion = 0;
|
||||
return Read(string("version"), nVersion);
|
||||
}
|
||||
|
||||
bool WriteVersion(int nVersion)
|
||||
{
|
||||
return Write(string("version"), nVersion);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CTxDB : public CDB
|
||||
{
|
||||
public:
|
||||
CTxDB(const char* pszMode="r+") : CDB("blkindex.dat", pszMode) { }
|
||||
private:
|
||||
CTxDB(const CTxDB&);
|
||||
void operator=(const CTxDB&);
|
||||
public:
|
||||
bool ReadTxIndex(uint256 hash, CTxIndex& txindex);
|
||||
bool UpdateTxIndex(uint256 hash, const CTxIndex& txindex);
|
||||
bool AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight);
|
||||
bool EraseTxIndex(const CTransaction& tx);
|
||||
bool ContainsTx(uint256 hash);
|
||||
bool ReadOwnerTxes(uint160 hash160, int nHeight, vector<CTransaction>& vtx);
|
||||
bool ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex);
|
||||
bool ReadDiskTx(uint256 hash, CTransaction& tx);
|
||||
bool ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex);
|
||||
bool ReadDiskTx(COutPoint outpoint, CTransaction& tx);
|
||||
bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
|
||||
bool EraseBlockIndex(uint256 hash);
|
||||
bool ReadHashBestChain(uint256& hashBestChain);
|
||||
bool WriteHashBestChain(uint256 hashBestChain);
|
||||
bool ReadBestInvalidWork(CBigNum& bnBestInvalidWork);
|
||||
bool WriteBestInvalidWork(CBigNum bnBestInvalidWork);
|
||||
bool LoadBlockIndex();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CAddrDB : public CDB
|
||||
{
|
||||
public:
|
||||
CAddrDB(const char* pszMode="r+") : CDB("addr.dat", pszMode) { }
|
||||
private:
|
||||
CAddrDB(const CAddrDB&);
|
||||
void operator=(const CAddrDB&);
|
||||
public:
|
||||
bool WriteAddress(const CAddress& addr);
|
||||
bool EraseAddress(const CAddress& addr);
|
||||
bool LoadAddresses();
|
||||
};
|
||||
|
||||
bool LoadAddresses();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CKeyPool
|
||||
{
|
||||
public:
|
||||
int64 nTime;
|
||||
vector<unsigned char> vchPubKey;
|
||||
|
||||
CKeyPool()
|
||||
{
|
||||
nTime = GetTime();
|
||||
}
|
||||
|
||||
CKeyPool(const vector<unsigned char>& vchPubKeyIn)
|
||||
{
|
||||
nTime = GetTime();
|
||||
vchPubKey = vchPubKeyIn;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
if (!(nType & SER_GETHASH))
|
||||
READWRITE(nVersion);
|
||||
READWRITE(nTime);
|
||||
READWRITE(vchPubKey);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CWalletDB : public CDB
|
||||
{
|
||||
public:
|
||||
CWalletDB(const char* pszMode="r+") : CDB("wallet.dat", pszMode)
|
||||
{
|
||||
}
|
||||
private:
|
||||
CWalletDB(const CWalletDB&);
|
||||
void operator=(const CWalletDB&);
|
||||
public:
|
||||
bool ReadName(const string& strAddress, string& strName)
|
||||
{
|
||||
strName = "";
|
||||
return Read(make_pair(string("name"), strAddress), strName);
|
||||
}
|
||||
|
||||
bool WriteName(const string& strAddress, const string& strName)
|
||||
{
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
mapAddressBook[strAddress] = strName;
|
||||
nWalletDBUpdated++;
|
||||
return Write(make_pair(string("name"), strAddress), strName);
|
||||
}
|
||||
|
||||
bool EraseName(const string& strAddress)
|
||||
{
|
||||
// This should only be used for sending addresses, never for receiving addresses,
|
||||
// receiving addresses must always have an address book entry if they're not change return.
|
||||
CRITICAL_BLOCK(cs_mapAddressBook)
|
||||
mapAddressBook.erase(strAddress);
|
||||
nWalletDBUpdated++;
|
||||
return Erase(make_pair(string("name"), strAddress));
|
||||
}
|
||||
|
||||
bool ReadTx(uint256 hash, CWalletTx& wtx)
|
||||
{
|
||||
return Read(make_pair(string("tx"), hash), wtx);
|
||||
}
|
||||
|
||||
bool WriteTx(uint256 hash, const CWalletTx& wtx)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Write(make_pair(string("tx"), hash), wtx);
|
||||
}
|
||||
|
||||
bool EraseTx(uint256 hash)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Erase(make_pair(string("tx"), hash));
|
||||
}
|
||||
|
||||
bool ReadKey(const vector<unsigned char>& vchPubKey, CPrivKey& vchPrivKey)
|
||||
{
|
||||
vchPrivKey.clear();
|
||||
return Read(make_pair(string("key"), vchPubKey), vchPrivKey);
|
||||
}
|
||||
|
||||
bool WriteKey(const vector<unsigned char>& vchPubKey, const CPrivKey& vchPrivKey)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Write(make_pair(string("key"), vchPubKey), vchPrivKey, false);
|
||||
}
|
||||
|
||||
bool WriteBestBlock(const CBlockLocator& locator)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Write(string("bestblock"), locator);
|
||||
}
|
||||
|
||||
bool ReadBestBlock(CBlockLocator& locator)
|
||||
{
|
||||
return Read(string("bestblock"), locator);
|
||||
}
|
||||
|
||||
bool ReadDefaultKey(vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
vchPubKey.clear();
|
||||
return Read(string("defaultkey"), vchPubKey);
|
||||
}
|
||||
|
||||
bool WriteDefaultKey(const vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
vchDefaultKey = vchPubKey;
|
||||
nWalletDBUpdated++;
|
||||
return Write(string("defaultkey"), vchPubKey);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool ReadSetting(const string& strKey, T& value)
|
||||
{
|
||||
return Read(make_pair(string("setting"), strKey), value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool WriteSetting(const string& strKey, const T& value)
|
||||
{
|
||||
nWalletDBUpdated++;
|
||||
return Write(make_pair(string("setting"), strKey), value);
|
||||
}
|
||||
|
||||
bool ReadAccount(const string& strAccount, CAccount& account);
|
||||
bool WriteAccount(const string& strAccount, const CAccount& account);
|
||||
bool WriteAccountingEntry(const CAccountingEntry& acentry);
|
||||
int64 GetAccountCreditDebit(const string& strAccount);
|
||||
void ListAccountCreditDebit(const string& strAccount, list<CAccountingEntry>& acentries);
|
||||
|
||||
bool LoadWallet();
|
||||
protected:
|
||||
void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool);
|
||||
void KeepKey(int64 nIndex);
|
||||
static void ReturnKey(int64 nIndex);
|
||||
friend class CReserveKey;
|
||||
friend vector<unsigned char> GetKeyFromKeyPool();
|
||||
friend int64 GetOldestKeyPoolTime();
|
||||
};
|
||||
|
||||
bool LoadWallet(bool& fFirstRunRet);
|
||||
void BackupWallet(const string& strDest);
|
||||
|
||||
inline bool SetAddressBookName(const string& strAddress, const string& strName)
|
||||
{
|
||||
return CWalletDB().WriteName(strAddress, strName);
|
||||
}
|
||||
|
||||
class CReserveKey
|
||||
{
|
||||
protected:
|
||||
int64 nIndex;
|
||||
vector<unsigned char> vchPubKey;
|
||||
public:
|
||||
CReserveKey()
|
||||
{
|
||||
nIndex = -1;
|
||||
}
|
||||
|
||||
~CReserveKey()
|
||||
{
|
||||
if (!fShutdown)
|
||||
ReturnKey();
|
||||
}
|
||||
|
||||
vector<unsigned char> GetReservedKey()
|
||||
{
|
||||
if (nIndex == -1)
|
||||
{
|
||||
CKeyPool keypool;
|
||||
CWalletDB().ReserveKeyFromKeyPool(nIndex, keypool);
|
||||
vchPubKey = keypool.vchPubKey;
|
||||
}
|
||||
assert(!vchPubKey.empty());
|
||||
return vchPubKey;
|
||||
}
|
||||
|
||||
void KeepKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB().KeepKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
|
||||
void ReturnKey()
|
||||
{
|
||||
if (nIndex != -1)
|
||||
CWalletDB::ReturnKey(nIndex);
|
||||
nIndex = -1;
|
||||
vchPubKey.clear();
|
||||
}
|
||||
};
|
||||
147
src/headers.h
Normal file
147
src/headers.h
Normal file
@@ -0,0 +1,147 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4804)
|
||||
#pragma warning(disable:4805)
|
||||
#pragma warning(disable:4717)
|
||||
#endif
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#ifdef _WIN32_IE
|
||||
#undef _WIN32_IE
|
||||
#endif
|
||||
#define _WIN32_IE 0x0400
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#define __STDC_LIMIT_MACROS // to enable UINT64_MAX from stdint.h
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
#include <sys/param.h> // to get BSD define
|
||||
#endif
|
||||
#ifdef __WXMAC_OSX__
|
||||
#ifndef BSD
|
||||
#define BSD 1
|
||||
#endif
|
||||
#endif
|
||||
#ifdef GUI
|
||||
#include <wx/wx.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/snglinst.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/taskbar.h>
|
||||
#endif
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <db_cxx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include <assert.h>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/tuple/tuple_comparison.hpp>
|
||||
#include <boost/tuple/tuple_io.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/interprocess/sync/file_lock.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
||||
#include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/program_options/detail/config_file.hpp>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <mswsock.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef BSD
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
|
||||
#pragma hdrstop
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
#include "strlcpy.h"
|
||||
#include "serialize.h"
|
||||
#include "uint256.h"
|
||||
#include "util.h"
|
||||
#include "key.h"
|
||||
#include "bignum.h"
|
||||
#include "base58.h"
|
||||
#include "script.h"
|
||||
#include "db.h"
|
||||
#include "net.h"
|
||||
#include "irc.h"
|
||||
#include "main.h"
|
||||
#include "rpc.h"
|
||||
#ifdef GUI
|
||||
#include "uibase.h"
|
||||
#include "ui.h"
|
||||
#else
|
||||
#include "noui.h"
|
||||
#endif
|
||||
#include "init.h"
|
||||
|
||||
#include "xpm/addressbook16.xpm"
|
||||
#include "xpm/addressbook20.xpm"
|
||||
#include "xpm/bitcoin16.xpm"
|
||||
#include "xpm/bitcoin20.xpm"
|
||||
#include "xpm/bitcoin32.xpm"
|
||||
#include "xpm/bitcoin48.xpm"
|
||||
#include "xpm/bitcoin80.xpm"
|
||||
#include "xpm/check.xpm"
|
||||
#include "xpm/send16.xpm"
|
||||
#include "xpm/send16noshadow.xpm"
|
||||
#include "xpm/send20.xpm"
|
||||
#include "xpm/about.xpm"
|
||||
523
src/init.cpp
Normal file
523
src/init.cpp
Normal file
@@ -0,0 +1,523 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Shutdown
|
||||
//
|
||||
|
||||
void ExitTimeout(void* parg)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
Sleep(5000);
|
||||
ExitProcess(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown(void* parg)
|
||||
{
|
||||
static CCriticalSection cs_Shutdown;
|
||||
static bool fTaken;
|
||||
bool fFirstThread;
|
||||
CRITICAL_BLOCK(cs_Shutdown)
|
||||
{
|
||||
fFirstThread = !fTaken;
|
||||
fTaken = true;
|
||||
}
|
||||
static bool fExit;
|
||||
if (fFirstThread)
|
||||
{
|
||||
fShutdown = true;
|
||||
nTransactionsUpdated++;
|
||||
DBFlush(false);
|
||||
StopNode();
|
||||
DBFlush(true);
|
||||
boost::filesystem::remove(GetPidFile());
|
||||
CreateThread(ExitTimeout, NULL);
|
||||
Sleep(50);
|
||||
printf("Bitcoin exiting\n\n");
|
||||
fExit = true;
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!fExit)
|
||||
Sleep(500);
|
||||
Sleep(100);
|
||||
ExitThread(0);
|
||||
}
|
||||
}
|
||||
|
||||
void HandleSIGTERM(int)
|
||||
{
|
||||
fRequestShutdown = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Start
|
||||
//
|
||||
|
||||
#ifndef GUI
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
fRet = AppInit(argc, argv);
|
||||
|
||||
if (fRet && fDaemon)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AppInit(int argc, char* argv[])
|
||||
{
|
||||
bool fRet = false;
|
||||
try
|
||||
{
|
||||
fRet = AppInit2(argc, argv);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintException(&e, "AppInit()");
|
||||
} catch (...) {
|
||||
PrintException(NULL, "AppInit()");
|
||||
}
|
||||
if (!fRet)
|
||||
Shutdown(NULL);
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool AppInit2(int argc, char* argv[])
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Turn off microsoft heap dump noise
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
|
||||
#endif
|
||||
#if _MSC_VER >= 1400
|
||||
// Disable confusing "helpful" text message on abort, ctrl-c
|
||||
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
umask(077);
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
// Clean shutdown on SIGTERM
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = HandleSIGTERM;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
if (mapArgs.count("-datadir"))
|
||||
{
|
||||
filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
|
||||
strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
|
||||
}
|
||||
|
||||
ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
|
||||
|
||||
if (mapArgs.count("-?") || mapArgs.count("--help"))
|
||||
{
|
||||
string beta = VERSION_IS_BETA ? _(" beta") : "";
|
||||
string strUsage = string() +
|
||||
_("Bitcoin version") + " " + FormatFullVersion() + "\n\n" +
|
||||
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
|
||||
" bitcoin [options] \t " + "\n" +
|
||||
" bitcoin [options] <command> [params]\t " + _("Send command to -server or bitcoind\n") +
|
||||
" bitcoin [options] help \t\t " + _("List commands\n") +
|
||||
" bitcoin [options] help <command> \t\t " + _("Get help for a command\n") +
|
||||
_("Options:\n") +
|
||||
" -conf=<file> \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") +
|
||||
" -pid=<file> \t\t " + _("Specify pid file (default: bitcoind.pid)\n") +
|
||||
" -gen \t\t " + _("Generate coins\n") +
|
||||
" -gen=0 \t\t " + _("Don't generate coins\n") +
|
||||
" -min \t\t " + _("Start minimized\n") +
|
||||
" -datadir=<dir> \t\t " + _("Specify data directory\n") +
|
||||
" -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
|
||||
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
|
||||
" -connect=<ip> \t\t " + _("Connect only to the specified node\n") +
|
||||
" -nolisten \t " + _("Don't accept connections from outside\n") +
|
||||
#ifdef USE_UPNP
|
||||
#if USE_UPNP
|
||||
" -noupnp \t " + _("Don't attempt to use UPnP to map the listening port\n") +
|
||||
#else
|
||||
" -upnp \t " + _("Attempt to use UPnP to map the listening port\n") +
|
||||
#endif
|
||||
#endif
|
||||
" -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") +
|
||||
#ifdef GUI
|
||||
" -server \t\t " + _("Accept command line and JSON-RPC commands\n") +
|
||||
#endif
|
||||
#ifndef __WXMSW__
|
||||
" -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
|
||||
#endif
|
||||
" -testnet \t\t " + _("Use the test network\n") +
|
||||
" -rpcuser=<user> \t " + _("Username for JSON-RPC connections\n") +
|
||||
" -rpcpassword=<pw>\t " + _("Password for JSON-RPC connections\n") +
|
||||
" -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port> (default: 8332)\n") +
|
||||
" -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address\n") +
|
||||
" -rpcconnect=<ip> \t " + _("Send commands to node running on <ip> (default: 127.0.0.1)\n") +
|
||||
" -keypool=<n> \t " + _("Set key pool size to <n> (default: 100)\n") +
|
||||
" -rescan \t " + _("Rescan the block chain for missing wallet transactions\n");
|
||||
|
||||
#ifdef USE_SSL
|
||||
strUsage += string() +
|
||||
_("\nSSL options: (see the Bitcoin Wiki for SSL setup instructions)\n") +
|
||||
" -rpcssl \t " + _("Use OpenSSL (https) for JSON-RPC connections\n") +
|
||||
" -rpcsslcertificatechainfile=<file.cert>\t " + _("Server certificate file (default: server.cert)\n") +
|
||||
" -rpcsslprivatekeyfile=<file.pem> \t " + _("Server private key (default: server.pem)\n") +
|
||||
" -rpcsslciphers=<ciphers> \t " + _("Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n");
|
||||
#endif
|
||||
|
||||
strUsage += string() +
|
||||
" -? \t\t " + _("This help message\n");
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// Tabs make the columns line up in the message box
|
||||
wxMessageBox(strUsage, "Bitcoin", wxOK);
|
||||
#else
|
||||
// Remove tabs
|
||||
strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
|
||||
fprintf(stderr, "%s", strUsage.c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
fDebug = GetBoolArg("-debug");
|
||||
|
||||
#ifndef __WXMSW__
|
||||
fDaemon = GetBoolArg("-daemon");
|
||||
#else
|
||||
fDaemon = false;
|
||||
#endif
|
||||
|
||||
if (fDaemon)
|
||||
fServer = true;
|
||||
else
|
||||
fServer = GetBoolArg("-server");
|
||||
|
||||
/* force fServer when running without GUI */
|
||||
#ifndef GUI
|
||||
fServer = true;
|
||||
#endif
|
||||
|
||||
fPrintToConsole = GetBoolArg("-printtoconsole");
|
||||
fPrintToDebugger = GetBoolArg("-printtodebugger");
|
||||
|
||||
fTestNet = GetBoolArg("-testnet");
|
||||
fNoListen = GetBoolArg("-nolisten");
|
||||
fLogTimestamps = GetBoolArg("-logtimestamps");
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
if (!IsSwitchChar(argv[i][0]))
|
||||
fCommandLine = true;
|
||||
|
||||
if (fCommandLine)
|
||||
{
|
||||
int ret = CommandLineRPC(argc, argv);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
#ifndef __WXMSW__
|
||||
if (fDaemon)
|
||||
{
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
if (pid < 0)
|
||||
{
|
||||
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
|
||||
return false;
|
||||
}
|
||||
if (pid > 0)
|
||||
{
|
||||
CreatePidFile(GetPidFile(), pid);
|
||||
return true;
|
||||
}
|
||||
|
||||
pid_t sid = setsid();
|
||||
if (sid < 0)
|
||||
fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!fDebug && !pszSetDataDir[0])
|
||||
ShrinkDebugFile();
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
|
||||
printf("Bitcoin version %s\n", FormatFullVersion().c_str());
|
||||
#ifdef GUI
|
||||
printf("OS version %s\n", ((string)wxGetOsDescription()).c_str());
|
||||
printf("System default language is %d %s\n", g_locale.GetSystemLanguage(), ((string)g_locale.GetSysName()).c_str());
|
||||
printf("Language file %s (%s)\n", (string("locale/") + (string)g_locale.GetCanonicalName() + "/LC_MESSAGES/bitcoin.mo").c_str(), ((string)g_locale.GetLocale()).c_str());
|
||||
#endif
|
||||
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
|
||||
|
||||
if (GetBoolArg("-loadblockindextest"))
|
||||
{
|
||||
CTxDB txdb("r");
|
||||
txdb.LoadBlockIndex();
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Limit to single instance per user
|
||||
// Required to protect the database files if we're going to keep deleting log.*
|
||||
//
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
// wxSingleInstanceChecker doesn't work on Linux
|
||||
wxString strMutexName = wxString("bitcoin_running.") + getenv("HOMEPATH");
|
||||
for (int i = 0; i < strMutexName.size(); i++)
|
||||
if (!isalnum(strMutexName[i]))
|
||||
strMutexName[i] = '.';
|
||||
wxSingleInstanceChecker* psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (psingleinstancechecker->IsAnotherRunning())
|
||||
{
|
||||
printf("Existing instance found\n");
|
||||
unsigned int nStart = GetTime();
|
||||
loop
|
||||
{
|
||||
// Show the previous instance and exit
|
||||
HWND hwndPrev = FindWindowA("wxWindowClassNR", "Bitcoin");
|
||||
if (hwndPrev)
|
||||
{
|
||||
if (IsIconic(hwndPrev))
|
||||
ShowWindow(hwndPrev, SW_RESTORE);
|
||||
SetForegroundWindow(hwndPrev);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetTime() > nStart + 60)
|
||||
return false;
|
||||
|
||||
// Resume this instance if the other exits
|
||||
delete psingleinstancechecker;
|
||||
Sleep(1000);
|
||||
psingleinstancechecker = new wxSingleInstanceChecker(strMutexName);
|
||||
if (!psingleinstancechecker->IsAnotherRunning())
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Make sure only a single bitcoin process is using the data directory.
|
||||
string strLockFile = GetDataDir() + "/.lock";
|
||||
FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||
if (file) fclose(file);
|
||||
static boost::interprocess::file_lock lock(strLockFile.c_str());
|
||||
if (!lock.try_lock())
|
||||
{
|
||||
wxMessageBox(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin is probably already running."), GetDataDir().c_str()), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bind to the port early so we can tell if another instance is already running.
|
||||
string strErrors;
|
||||
if (!fNoListen)
|
||||
{
|
||||
if (!BindListenPort(strErrors))
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load data files
|
||||
//
|
||||
if (fDaemon)
|
||||
fprintf(stdout, "bitcoin server starting\n");
|
||||
strErrors = "";
|
||||
int64 nStart;
|
||||
|
||||
printf("Loading addresses...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadAddresses())
|
||||
strErrors += _("Error loading addr.dat \n");
|
||||
printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading block index...\n");
|
||||
nStart = GetTimeMillis();
|
||||
if (!LoadBlockIndex())
|
||||
strErrors += _("Error loading blkindex.dat \n");
|
||||
printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
printf("Loading wallet...\n");
|
||||
nStart = GetTimeMillis();
|
||||
bool fFirstRun;
|
||||
if (!LoadWallet(fFirstRun))
|
||||
strErrors += _("Error loading wallet.dat \n");
|
||||
printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
|
||||
CBlockIndex *pindexRescan = pindexBest;
|
||||
if (GetBoolArg("-rescan"))
|
||||
pindexRescan = pindexGenesisBlock;
|
||||
else
|
||||
{
|
||||
CWalletDB walletdb;
|
||||
CBlockLocator locator;
|
||||
if (walletdb.ReadBestBlock(locator))
|
||||
pindexRescan = locator.GetBlockIndex();
|
||||
}
|
||||
if (pindexBest != pindexRescan)
|
||||
{
|
||||
printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
|
||||
nStart = GetTimeMillis();
|
||||
ScanForWalletTransactions(pindexRescan);
|
||||
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||
}
|
||||
|
||||
printf("Done loading\n");
|
||||
|
||||
//// debug print
|
||||
printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size());
|
||||
printf("nBestHeight = %d\n", nBestHeight);
|
||||
printf("mapKeys.size() = %d\n", mapKeys.size());
|
||||
printf("mapPubKeys.size() = %d\n", mapPubKeys.size());
|
||||
printf("mapWallet.size() = %d\n", mapWallet.size());
|
||||
printf("mapAddressBook.size() = %d\n", mapAddressBook.size());
|
||||
|
||||
if (!strErrors.empty())
|
||||
{
|
||||
wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add wallet transactions that aren't already in a block to mapTransactions
|
||||
ReacceptWalletTransactions();
|
||||
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
|
||||
{
|
||||
PrintBlockTree();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mapArgs.count("-printblock"))
|
||||
{
|
||||
string strMatch = mapArgs["-printblock"];
|
||||
int nFound = 0;
|
||||
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
|
||||
{
|
||||
uint256 hash = (*mi).first;
|
||||
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
CBlock block;
|
||||
block.ReadFromDisk(pindex);
|
||||
block.BuildMerkleTree();
|
||||
block.print();
|
||||
printf("\n");
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
if (nFound == 0)
|
||||
printf("No blocks matching %s were found\n", strMatch.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
fGenerateBitcoins = GetBoolArg("-gen");
|
||||
|
||||
if (mapArgs.count("-proxy"))
|
||||
{
|
||||
fUseProxy = true;
|
||||
addrProxy = CAddress(mapArgs["-proxy"]);
|
||||
if (!addrProxy.IsValid())
|
||||
{
|
||||
wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mapArgs.count("-addnode"))
|
||||
{
|
||||
foreach(string strAddr, mapMultiArgs["-addnode"])
|
||||
{
|
||||
CAddress addr(strAddr, NODE_NETWORK);
|
||||
addr.nTime = 0; // so it won't relay unless successfully connected
|
||||
if (addr.IsValid())
|
||||
AddAddress(addr);
|
||||
}
|
||||
}
|
||||
|
||||
if (mapArgs.count("-dnsseed"))
|
||||
DNSAddressSeed();
|
||||
|
||||
if (mapArgs.count("-paytxfee"))
|
||||
{
|
||||
if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
|
||||
{
|
||||
wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
|
||||
return false;
|
||||
}
|
||||
if (nTransactionFee > 0.25 * COIN)
|
||||
wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
|
||||
}
|
||||
|
||||
if (fHaveUPnP)
|
||||
{
|
||||
#if USE_UPNP
|
||||
if (GetBoolArg("-noupnp"))
|
||||
fUseUPnP = false;
|
||||
#else
|
||||
if (GetBoolArg("-upnp"))
|
||||
fUseUPnP = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Create the main window and start the node
|
||||
//
|
||||
#ifdef GUI
|
||||
if (!fDaemon)
|
||||
CreateMainWindow();
|
||||
#endif
|
||||
|
||||
if (!CheckDiskSpace())
|
||||
return false;
|
||||
|
||||
RandAddSeedPerfmon();
|
||||
|
||||
if (!CreateThread(StartNode, NULL))
|
||||
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
|
||||
|
||||
if (fServer)
|
||||
CreateThread(ThreadRPCServer, NULL);
|
||||
|
||||
#if defined(__WXMSW__) && defined(GUI)
|
||||
if (fFirstRun)
|
||||
SetStartOnSystemStartup(true);
|
||||
#endif
|
||||
|
||||
#ifndef GUI
|
||||
while (1)
|
||||
Sleep(5000);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
7
src/init.h
Normal file
7
src/init.h
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
void Shutdown(void* parg);
|
||||
bool AppInit(int argc, char* argv[]);
|
||||
bool AppInit2(int argc, char* argv[]);
|
||||
445
src/irc.cpp
Normal file
445
src/irc.cpp
Normal file
@@ -0,0 +1,445 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
int nGotIRCAddresses = 0;
|
||||
bool fGotExternalIP = false;
|
||||
|
||||
void ThreadIRCSeed2(void* parg);
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct ircaddr
|
||||
{
|
||||
int ip;
|
||||
short port;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
string EncodeAddress(const CAddress& addr)
|
||||
{
|
||||
struct ircaddr tmp;
|
||||
tmp.ip = addr.ip;
|
||||
tmp.port = addr.port;
|
||||
|
||||
vector<unsigned char> vch(UBEGIN(tmp), UEND(tmp));
|
||||
return string("u") + EncodeBase58Check(vch);
|
||||
}
|
||||
|
||||
bool DecodeAddress(string str, CAddress& addr)
|
||||
{
|
||||
vector<unsigned char> vch;
|
||||
if (!DecodeBase58Check(str.substr(1), vch))
|
||||
return false;
|
||||
|
||||
struct ircaddr tmp;
|
||||
if (vch.size() != sizeof(tmp))
|
||||
return false;
|
||||
memcpy(&tmp, &vch[0], sizeof(tmp));
|
||||
|
||||
addr = CAddress(tmp.ip, tmp.port, NODE_NETWORK);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static bool Send(SOCKET hSocket, const char* pszSend)
|
||||
{
|
||||
if (strstr(pszSend, "PONG") != pszSend)
|
||||
printf("IRC SENDING: %s\n", pszSend);
|
||||
const char* psz = pszSend;
|
||||
const char* pszEnd = psz + strlen(psz);
|
||||
while (psz < pszEnd)
|
||||
{
|
||||
int ret = send(hSocket, psz, pszEnd - psz, MSG_NOSIGNAL);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
psz += ret;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecvLine(SOCKET hSocket, string& strLine)
|
||||
{
|
||||
strLine = "";
|
||||
loop
|
||||
{
|
||||
char c;
|
||||
int nBytes = recv(hSocket, &c, 1, 0);
|
||||
if (nBytes > 0)
|
||||
{
|
||||
if (c == '\n')
|
||||
continue;
|
||||
if (c == '\r')
|
||||
return true;
|
||||
strLine += c;
|
||||
if (strLine.size() >= 9000)
|
||||
return true;
|
||||
}
|
||||
else if (nBytes <= 0)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
if (nBytes < 0)
|
||||
{
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEMSGSIZE)
|
||||
continue;
|
||||
if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS)
|
||||
{
|
||||
Sleep(10);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!strLine.empty())
|
||||
return true;
|
||||
if (nBytes == 0)
|
||||
{
|
||||
// socket closed
|
||||
printf("IRC socket closed\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// socket error
|
||||
int nErr = WSAGetLastError();
|
||||
printf("IRC recv failed: %d\n", nErr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RecvLineIRC(SOCKET hSocket, string& strLine)
|
||||
{
|
||||
loop
|
||||
{
|
||||
bool fRet = RecvLine(hSocket, strLine);
|
||||
if (fRet)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() >= 1 && vWords[0] == "PING")
|
||||
{
|
||||
strLine[1] = 'O';
|
||||
strLine += '\r';
|
||||
Send(hSocket, strLine.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return fRet;
|
||||
}
|
||||
}
|
||||
|
||||
int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL)
|
||||
{
|
||||
loop
|
||||
{
|
||||
string strLine;
|
||||
strLine.reserve(10000);
|
||||
if (!RecvLineIRC(hSocket, strLine))
|
||||
return 0;
|
||||
printf("IRC %s\n", strLine.c_str());
|
||||
if (psz1 && strLine.find(psz1) != -1)
|
||||
return 1;
|
||||
if (psz2 && strLine.find(psz2) != -1)
|
||||
return 2;
|
||||
if (psz3 && strLine.find(psz3) != -1)
|
||||
return 3;
|
||||
if (psz4 && strLine.find(psz4) != -1)
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
bool Wait(int nSeconds)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
printf("IRC waiting %d seconds to reconnect\n", nSeconds);
|
||||
for (int i = 0; i < nSeconds; i++)
|
||||
{
|
||||
if (fShutdown)
|
||||
return false;
|
||||
Sleep(1000);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
|
||||
{
|
||||
strRet.clear();
|
||||
loop
|
||||
{
|
||||
string strLine;
|
||||
if (!RecvLineIRC(hSocket, strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 2)
|
||||
continue;
|
||||
|
||||
if (vWords[1] == psz1)
|
||||
{
|
||||
printf("IRC %s\n", strLine.c_str());
|
||||
strRet = strLine;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GetIPFromIRC(SOCKET hSocket, string strMyName, unsigned int& ipRet)
|
||||
{
|
||||
Send(hSocket, strprintf("USERHOST %s\r", strMyName.c_str()).c_str());
|
||||
|
||||
string strLine;
|
||||
if (!RecvCodeLine(hSocket, "302", strLine))
|
||||
return false;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 4)
|
||||
return false;
|
||||
|
||||
string str = vWords[3];
|
||||
if (str.rfind("@") == string::npos)
|
||||
return false;
|
||||
string strHost = str.substr(str.rfind("@")+1);
|
||||
|
||||
unsigned int a=0, b=0, c=0, d=0;
|
||||
if (sscanf(strHost.c_str(), "%u.%u.%u.%u", &a, &b, &c, &d) == 4 &&
|
||||
inet_addr(strHost.c_str()) != INADDR_NONE)
|
||||
{
|
||||
printf("GetIPFromIRC() userhost is IP %s\n", strHost.c_str());
|
||||
ipRet = CAddress(strHost).ip;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hybrid IRC used by lfnet always returns IP when you userhost yourself,
|
||||
// but in case another IRC is ever used this should work.
|
||||
printf("GetIPFromIRC() got userhost %s\n", strHost.c_str());
|
||||
if (fUseProxy)
|
||||
return false;
|
||||
struct hostent* phostent = gethostbyname(strHost.c_str());
|
||||
if (!phostent || !phostent->h_addr_list || !phostent->h_addr_list[0])
|
||||
return false;
|
||||
ipRet = *(u_long*)phostent->h_addr_list[0];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ThreadIRCSeed(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadIRCSeed(parg));
|
||||
try
|
||||
{
|
||||
ThreadIRCSeed2(parg);
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
PrintExceptionContinue(&e, "ThreadIRCSeed()");
|
||||
} catch (...) {
|
||||
PrintExceptionContinue(NULL, "ThreadIRCSeed()");
|
||||
}
|
||||
printf("ThreadIRCSeed exiting\n");
|
||||
}
|
||||
|
||||
void ThreadIRCSeed2(void* parg)
|
||||
{
|
||||
/* Dont advertise on IRC if we don't allow incoming connections */
|
||||
if (mapArgs.count("-connect") || fNoListen)
|
||||
return;
|
||||
|
||||
if (GetBoolArg("-noirc"))
|
||||
return;
|
||||
printf("ThreadIRCSeed started\n");
|
||||
int nErrorWait = 10;
|
||||
int nRetryWait = 10;
|
||||
bool fNameInUse = false;
|
||||
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
|
||||
|
||||
while (!fShutdown)
|
||||
{
|
||||
//CAddress addrConnect("216.155.130.130:6667"); // chat.freenode.net
|
||||
CAddress addrConnect("92.243.23.21:6667"); // irc.lfnet.org
|
||||
if (!fTOR)
|
||||
{
|
||||
//struct hostent* phostent = gethostbyname("chat.freenode.net");
|
||||
struct hostent* phostent = gethostbyname("irc.lfnet.org");
|
||||
if (phostent && phostent->h_addr_list && phostent->h_addr_list[0])
|
||||
addrConnect = CAddress(*(u_long*)phostent->h_addr_list[0], htons(6667));
|
||||
}
|
||||
|
||||
SOCKET hSocket;
|
||||
if (!ConnectSocket(addrConnect, hSocket))
|
||||
{
|
||||
printf("IRC connect failed\n");
|
||||
nErrorWait = nErrorWait * 11 / 10;
|
||||
if (Wait(nErrorWait += 60))
|
||||
continue;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RecvUntil(hSocket, "Found your hostname", "using your IP address instead", "Couldn't look up your hostname", "ignoring hostname"))
|
||||
{
|
||||
closesocket(hSocket);
|
||||
hSocket = INVALID_SOCKET;
|
||||
nErrorWait = nErrorWait * 11 / 10;
|
||||
if (Wait(nErrorWait += 60))
|
||||
continue;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
string strMyName;
|
||||
if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse)
|
||||
strMyName = EncodeAddress(addrLocalHost);
|
||||
else
|
||||
strMyName = strprintf("x%u", GetRand(1000000000));
|
||||
|
||||
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
|
||||
Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());
|
||||
|
||||
int nRet = RecvUntil(hSocket, " 004 ", " 433 ");
|
||||
if (nRet != 1)
|
||||
{
|
||||
closesocket(hSocket);
|
||||
hSocket = INVALID_SOCKET;
|
||||
if (nRet == 2)
|
||||
{
|
||||
printf("IRC name already in use\n");
|
||||
fNameInUse = true;
|
||||
Wait(10);
|
||||
continue;
|
||||
}
|
||||
nErrorWait = nErrorWait * 11 / 10;
|
||||
if (Wait(nErrorWait += 60))
|
||||
continue;
|
||||
else
|
||||
return;
|
||||
}
|
||||
Sleep(500);
|
||||
|
||||
// Get our external IP from the IRC server and re-nick before joining the channel
|
||||
CAddress addrFromIRC;
|
||||
if (GetIPFromIRC(hSocket, strMyName, addrFromIRC.ip))
|
||||
{
|
||||
printf("GetIPFromIRC() returned %s\n", addrFromIRC.ToStringIP().c_str());
|
||||
if (!fUseProxy && addrFromIRC.IsRoutable())
|
||||
{
|
||||
// IRC lets you to re-nick
|
||||
fGotExternalIP = true;
|
||||
addrLocalHost.ip = addrFromIRC.ip;
|
||||
strMyName = EncodeAddress(addrLocalHost);
|
||||
Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Send(hSocket, fTestNet ? "JOIN #bitcoinTEST\r" : "JOIN #bitcoin\r");
|
||||
Send(hSocket, fTestNet ? "WHO #bitcoinTEST\r" : "WHO #bitcoin\r");
|
||||
|
||||
int64 nStart = GetTime();
|
||||
string strLine;
|
||||
strLine.reserve(10000);
|
||||
while (!fShutdown && RecvLineIRC(hSocket, strLine))
|
||||
{
|
||||
if (strLine.empty() || strLine.size() > 900 || strLine[0] != ':')
|
||||
continue;
|
||||
|
||||
vector<string> vWords;
|
||||
ParseString(strLine, ' ', vWords);
|
||||
if (vWords.size() < 2)
|
||||
continue;
|
||||
|
||||
char pszName[10000];
|
||||
pszName[0] = '\0';
|
||||
|
||||
if (vWords[1] == "352" && vWords.size() >= 8)
|
||||
{
|
||||
// index 7 is limited to 16 characters
|
||||
// could get full length name at index 10, but would be different from join messages
|
||||
strlcpy(pszName, vWords[7].c_str(), sizeof(pszName));
|
||||
printf("IRC got who\n");
|
||||
}
|
||||
|
||||
if (vWords[1] == "JOIN" && vWords[0].size() > 1)
|
||||
{
|
||||
// :username!username@50000007.F000000B.90000002.IP JOIN :#channelname
|
||||
strlcpy(pszName, vWords[0].c_str() + 1, sizeof(pszName));
|
||||
if (strchr(pszName, '!'))
|
||||
*strchr(pszName, '!') = '\0';
|
||||
printf("IRC got join\n");
|
||||
}
|
||||
|
||||
if (pszName[0] == 'u')
|
||||
{
|
||||
CAddress addr;
|
||||
if (DecodeAddress(pszName, addr))
|
||||
{
|
||||
addr.nTime = GetAdjustedTime();
|
||||
if (AddAddress(addr, 51 * 60))
|
||||
printf("IRC got new address\n");
|
||||
nGotIRCAddresses++;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("IRC decode failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
closesocket(hSocket);
|
||||
hSocket = INVALID_SOCKET;
|
||||
|
||||
// IRC usually blocks TOR, so only try once
|
||||
if (fTOR)
|
||||
return;
|
||||
|
||||
if (GetTime() - nStart > 20 * 60)
|
||||
{
|
||||
nErrorWait /= 3;
|
||||
nRetryWait /= 3;
|
||||
}
|
||||
|
||||
nRetryWait = nRetryWait * 11 / 10;
|
||||
if (!Wait(nRetryWait += 60))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
WSADATA wsadata;
|
||||
if (WSAStartup(MAKEWORD(2,2), &wsadata) != NO_ERROR)
|
||||
{
|
||||
printf("Error at WSAStartup()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ThreadIRCSeed(NULL);
|
||||
|
||||
WSACleanup();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
9
src/irc.h
Normal file
9
src/irc.h
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
bool RecvLine(SOCKET hSocket, string& strLine);
|
||||
void ThreadIRCSeed(void* parg);
|
||||
|
||||
extern int nGotIRCAddresses;
|
||||
extern bool fGotExternalIP;
|
||||
24
src/json/LICENSE.txt
Normal file
24
src/json/LICENSE.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2007 - 2009 John W. Wilkinson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
18
src/json/json_spirit.h
Normal file
18
src/json/json_spirit.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef JSON_SPIRIT
|
||||
#define JSON_SPIRIT
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include "json_spirit_reader.h"
|
||||
#include "json_spirit_writer.h"
|
||||
#include "json_spirit_utils.h"
|
||||
|
||||
#endif
|
||||
54
src/json/json_spirit_error_position.h
Normal file
54
src/json/json_spirit_error_position.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef JSON_SPIRIT_ERROR_POSITION
|
||||
#define JSON_SPIRIT_ERROR_POSITION
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
// An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.
|
||||
// Note the "read_or_throw" functions are around 3 times slower than the standard functions "read"
|
||||
// functions that return a bool.
|
||||
//
|
||||
struct Error_position
|
||||
{
|
||||
Error_position();
|
||||
Error_position( unsigned int line, unsigned int column, const std::string& reason );
|
||||
bool operator==( const Error_position& lhs ) const;
|
||||
unsigned int line_;
|
||||
unsigned int column_;
|
||||
std::string reason_;
|
||||
};
|
||||
|
||||
inline Error_position::Error_position()
|
||||
: line_( 0 )
|
||||
, column_( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )
|
||||
: line_( line )
|
||||
, column_( column )
|
||||
, reason_( reason )
|
||||
{
|
||||
}
|
||||
|
||||
inline bool Error_position::operator==( const Error_position& lhs ) const
|
||||
{
|
||||
if( this == &lhs ) return true;
|
||||
|
||||
return ( reason_ == lhs.reason_ ) &&
|
||||
( line_ == lhs.line_ ) &&
|
||||
( column_ == lhs.column_ );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
137
src/json/json_spirit_reader.cpp
Normal file
137
src/json/json_spirit_reader.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#include "json_spirit_reader.h"
|
||||
#include "json_spirit_reader_template.h"
|
||||
|
||||
using namespace json_spirit;
|
||||
|
||||
bool json_spirit::read( const std::string& s, Value& value )
|
||||
{
|
||||
return read_string( s, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( const std::string& s, Value& value )
|
||||
{
|
||||
read_string_or_throw( s, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::istream& is, Value& value )
|
||||
{
|
||||
return read_stream( is, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::istream& is, Value& value )
|
||||
{
|
||||
read_stream_or_throw( is, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
|
||||
{
|
||||
return read_range( begin, end, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value )
|
||||
{
|
||||
begin = read_range_or_throw( begin, end, value );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
bool json_spirit::read( const std::wstring& s, wValue& value )
|
||||
{
|
||||
return read_string( s, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( const std::wstring& s, wValue& value )
|
||||
{
|
||||
read_string_or_throw( s, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::wistream& is, wValue& value )
|
||||
{
|
||||
return read_stream( is, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::wistream& is, wValue& value )
|
||||
{
|
||||
read_stream_or_throw( is, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
|
||||
{
|
||||
return read_range( begin, end, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value )
|
||||
{
|
||||
begin = read_range_or_throw( begin, end, value );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool json_spirit::read( const std::string& s, mValue& value )
|
||||
{
|
||||
return read_string( s, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( const std::string& s, mValue& value )
|
||||
{
|
||||
read_string_or_throw( s, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::istream& is, mValue& value )
|
||||
{
|
||||
return read_stream( is, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::istream& is, mValue& value )
|
||||
{
|
||||
read_stream_or_throw( is, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
|
||||
{
|
||||
return read_range( begin, end, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value )
|
||||
{
|
||||
begin = read_range_or_throw( begin, end, value );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
bool json_spirit::read( const std::wstring& s, wmValue& value )
|
||||
{
|
||||
return read_string( s, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( const std::wstring& s, wmValue& value )
|
||||
{
|
||||
read_string_or_throw( s, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::wistream& is, wmValue& value )
|
||||
{
|
||||
return read_stream( is, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::wistream& is, wmValue& value )
|
||||
{
|
||||
read_stream_or_throw( is, value );
|
||||
}
|
||||
|
||||
bool json_spirit::read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
|
||||
{
|
||||
return read_range( begin, end, value );
|
||||
}
|
||||
|
||||
void json_spirit::read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value )
|
||||
{
|
||||
begin = read_range_or_throw( begin, end, value );
|
||||
}
|
||||
|
||||
#endif
|
||||
62
src/json/json_spirit_reader.h
Normal file
62
src/json/json_spirit_reader.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef JSON_SPIRIT_READER
|
||||
#define JSON_SPIRIT_READER
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include "json_spirit_error_position.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
// functions to reads a JSON values
|
||||
|
||||
bool read( const std::string& s, Value& value );
|
||||
bool read( std::istream& is, Value& value );
|
||||
bool read( std::string::const_iterator& begin, std::string::const_iterator end, Value& value );
|
||||
|
||||
void read_or_throw( const std::string& s, Value& value );
|
||||
void read_or_throw( std::istream& is, Value& value );
|
||||
void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, Value& value );
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
bool read( const std::wstring& s, wValue& value );
|
||||
bool read( std::wistream& is, wValue& value );
|
||||
bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value );
|
||||
|
||||
void read_or_throw( const std::wstring& s, wValue& value );
|
||||
void read_or_throw( std::wistream& is, wValue& value );
|
||||
void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wValue& value );
|
||||
|
||||
#endif
|
||||
|
||||
bool read( const std::string& s, mValue& value );
|
||||
bool read( std::istream& is, mValue& value );
|
||||
bool read( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value );
|
||||
|
||||
void read_or_throw( const std::string& s, mValue& value );
|
||||
void read_or_throw( std::istream& is, mValue& value );
|
||||
void read_or_throw( std::string::const_iterator& begin, std::string::const_iterator end, mValue& value );
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
bool read( const std::wstring& s, wmValue& value );
|
||||
bool read( std::wistream& is, wmValue& value );
|
||||
bool read( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value );
|
||||
|
||||
void read_or_throw( const std::wstring& s, wmValue& value );
|
||||
void read_or_throw( std::wistream& is, wmValue& value );
|
||||
void read_or_throw( std::wstring::const_iterator& begin, std::wstring::const_iterator end, wmValue& value );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
612
src/json/json_spirit_reader_template.h
Normal file
612
src/json/json_spirit_reader_template.h
Normal file
@@ -0,0 +1,612 @@
|
||||
#ifndef JSON_SPIRIT_READER_TEMPLATE
|
||||
#define JSON_SPIRIT_READER_TEMPLATE
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include "json_spirit_error_position.h"
|
||||
|
||||
//#define BOOST_SPIRIT_THREADSAFE // uncomment for multithreaded use, requires linking to boost.thread
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 103800
|
||||
#include <boost/spirit/include/classic_core.hpp>
|
||||
#include <boost/spirit/include/classic_confix.hpp>
|
||||
#include <boost/spirit/include/classic_escape_char.hpp>
|
||||
#include <boost/spirit/include/classic_multi_pass.hpp>
|
||||
#include <boost/spirit/include/classic_position_iterator.hpp>
|
||||
#define spirit_namespace boost::spirit::classic
|
||||
#else
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/utility/confix.hpp>
|
||||
#include <boost/spirit/utility/escape_char.hpp>
|
||||
#include <boost/spirit/iterator/multi_pass.hpp>
|
||||
#include <boost/spirit/iterator/position_iterator.hpp>
|
||||
#define spirit_namespace boost::spirit
|
||||
#endif
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >();
|
||||
const spirit_namespace::uint_parser< boost::uint64_t > uint64_p = spirit_namespace::uint_parser< boost::uint64_t >();
|
||||
|
||||
template< class Iter_type >
|
||||
bool is_eq( Iter_type first, Iter_type last, const char* c_str )
|
||||
{
|
||||
for( Iter_type i = first; i != last; ++i, ++c_str )
|
||||
{
|
||||
if( *c_str == 0 ) return false;
|
||||
|
||||
if( *i != *c_str ) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template< class Char_type >
|
||||
Char_type hex_to_num( const Char_type c )
|
||||
{
|
||||
if( ( c >= '0' ) && ( c <= '9' ) ) return c - '0';
|
||||
if( ( c >= 'a' ) && ( c <= 'f' ) ) return c - 'a' + 10;
|
||||
if( ( c >= 'A' ) && ( c <= 'F' ) ) return c - 'A' + 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template< class Char_type, class Iter_type >
|
||||
Char_type hex_str_to_char( Iter_type& begin )
|
||||
{
|
||||
const Char_type c1( *( ++begin ) );
|
||||
const Char_type c2( *( ++begin ) );
|
||||
|
||||
return ( hex_to_num( c1 ) << 4 ) + hex_to_num( c2 );
|
||||
}
|
||||
|
||||
template< class Char_type, class Iter_type >
|
||||
Char_type unicode_str_to_char( Iter_type& begin )
|
||||
{
|
||||
const Char_type c1( *( ++begin ) );
|
||||
const Char_type c2( *( ++begin ) );
|
||||
const Char_type c3( *( ++begin ) );
|
||||
const Char_type c4( *( ++begin ) );
|
||||
|
||||
return ( hex_to_num( c1 ) << 12 ) +
|
||||
( hex_to_num( c2 ) << 8 ) +
|
||||
( hex_to_num( c3 ) << 4 ) +
|
||||
hex_to_num( c4 );
|
||||
}
|
||||
|
||||
template< class String_type >
|
||||
void append_esc_char_and_incr_iter( String_type& s,
|
||||
typename String_type::const_iterator& begin,
|
||||
typename String_type::const_iterator end )
|
||||
{
|
||||
typedef typename String_type::value_type Char_type;
|
||||
|
||||
const Char_type c2( *begin );
|
||||
|
||||
switch( c2 )
|
||||
{
|
||||
case 't': s += '\t'; break;
|
||||
case 'b': s += '\b'; break;
|
||||
case 'f': s += '\f'; break;
|
||||
case 'n': s += '\n'; break;
|
||||
case 'r': s += '\r'; break;
|
||||
case '\\': s += '\\'; break;
|
||||
case '/': s += '/'; break;
|
||||
case '"': s += '"'; break;
|
||||
case 'x':
|
||||
{
|
||||
if( end - begin >= 3 ) // expecting "xHH..."
|
||||
{
|
||||
s += hex_str_to_char< Char_type >( begin );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
{
|
||||
if( end - begin >= 5 ) // expecting "uHHHH..."
|
||||
{
|
||||
s += unicode_str_to_char< Char_type >( begin );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template< class String_type >
|
||||
String_type substitute_esc_chars( typename String_type::const_iterator begin,
|
||||
typename String_type::const_iterator end )
|
||||
{
|
||||
typedef typename String_type::const_iterator Iter_type;
|
||||
|
||||
if( end - begin < 2 ) return String_type( begin, end );
|
||||
|
||||
String_type result;
|
||||
|
||||
result.reserve( end - begin );
|
||||
|
||||
const Iter_type end_minus_1( end - 1 );
|
||||
|
||||
Iter_type substr_start = begin;
|
||||
Iter_type i = begin;
|
||||
|
||||
for( ; i < end_minus_1; ++i )
|
||||
{
|
||||
if( *i == '\\' )
|
||||
{
|
||||
result.append( substr_start, i );
|
||||
|
||||
++i; // skip the '\'
|
||||
|
||||
append_esc_char_and_incr_iter( result, i, end );
|
||||
|
||||
substr_start = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
result.append( substr_start, end );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template< class String_type >
|
||||
String_type get_str_( typename String_type::const_iterator begin,
|
||||
typename String_type::const_iterator end )
|
||||
{
|
||||
assert( end - begin >= 2 );
|
||||
|
||||
typedef typename String_type::const_iterator Iter_type;
|
||||
|
||||
Iter_type str_without_quotes( ++begin );
|
||||
Iter_type end_without_quotes( --end );
|
||||
|
||||
return substitute_esc_chars< String_type >( str_without_quotes, end_without_quotes );
|
||||
}
|
||||
|
||||
inline std::string get_str( std::string::const_iterator begin, std::string::const_iterator end )
|
||||
{
|
||||
return get_str_< std::string >( begin, end );
|
||||
}
|
||||
|
||||
inline std::wstring get_str( std::wstring::const_iterator begin, std::wstring::const_iterator end )
|
||||
{
|
||||
return get_str_< std::wstring >( begin, end );
|
||||
}
|
||||
|
||||
template< class String_type, class Iter_type >
|
||||
String_type get_str( Iter_type begin, Iter_type end )
|
||||
{
|
||||
const String_type tmp( begin, end ); // convert multipass iterators to string iterators
|
||||
|
||||
return get_str( tmp.begin(), tmp.end() );
|
||||
}
|
||||
|
||||
// this class's methods get called by the spirit parse resulting
|
||||
// in the creation of a JSON object or array
|
||||
//
|
||||
// NB Iter_type could be a std::string iterator, wstring iterator, a position iterator or a multipass iterator
|
||||
//
|
||||
template< class Value_type, class Iter_type >
|
||||
class Semantic_actions
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename Value_type::Config_type Config_type;
|
||||
typedef typename Config_type::String_type String_type;
|
||||
typedef typename Config_type::Object_type Object_type;
|
||||
typedef typename Config_type::Array_type Array_type;
|
||||
typedef typename String_type::value_type Char_type;
|
||||
|
||||
Semantic_actions( Value_type& value )
|
||||
: value_( value )
|
||||
, current_p_( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
void begin_obj( Char_type c )
|
||||
{
|
||||
assert( c == '{' );
|
||||
|
||||
begin_compound< Object_type >();
|
||||
}
|
||||
|
||||
void end_obj( Char_type c )
|
||||
{
|
||||
assert( c == '}' );
|
||||
|
||||
end_compound();
|
||||
}
|
||||
|
||||
void begin_array( Char_type c )
|
||||
{
|
||||
assert( c == '[' );
|
||||
|
||||
begin_compound< Array_type >();
|
||||
}
|
||||
|
||||
void end_array( Char_type c )
|
||||
{
|
||||
assert( c == ']' );
|
||||
|
||||
end_compound();
|
||||
}
|
||||
|
||||
void new_name( Iter_type begin, Iter_type end )
|
||||
{
|
||||
assert( current_p_->type() == obj_type );
|
||||
|
||||
name_ = get_str< String_type >( begin, end );
|
||||
}
|
||||
|
||||
void new_str( Iter_type begin, Iter_type end )
|
||||
{
|
||||
add_to_current( get_str< String_type >( begin, end ) );
|
||||
}
|
||||
|
||||
void new_true( Iter_type begin, Iter_type end )
|
||||
{
|
||||
assert( is_eq( begin, end, "true" ) );
|
||||
|
||||
add_to_current( true );
|
||||
}
|
||||
|
||||
void new_false( Iter_type begin, Iter_type end )
|
||||
{
|
||||
assert( is_eq( begin, end, "false" ) );
|
||||
|
||||
add_to_current( false );
|
||||
}
|
||||
|
||||
void new_null( Iter_type begin, Iter_type end )
|
||||
{
|
||||
assert( is_eq( begin, end, "null" ) );
|
||||
|
||||
add_to_current( Value_type() );
|
||||
}
|
||||
|
||||
void new_int( boost::int64_t i )
|
||||
{
|
||||
add_to_current( i );
|
||||
}
|
||||
|
||||
void new_uint64( boost::uint64_t ui )
|
||||
{
|
||||
add_to_current( ui );
|
||||
}
|
||||
|
||||
void new_real( double d )
|
||||
{
|
||||
add_to_current( d );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Semantic_actions& operator=( const Semantic_actions& );
|
||||
// to prevent "assignment operator could not be generated" warning
|
||||
|
||||
Value_type* add_first( const Value_type& value )
|
||||
{
|
||||
assert( current_p_ == 0 );
|
||||
|
||||
value_ = value;
|
||||
current_p_ = &value_;
|
||||
return current_p_;
|
||||
}
|
||||
|
||||
template< class Array_or_obj >
|
||||
void begin_compound()
|
||||
{
|
||||
if( current_p_ == 0 )
|
||||
{
|
||||
add_first( Array_or_obj() );
|
||||
}
|
||||
else
|
||||
{
|
||||
stack_.push_back( current_p_ );
|
||||
|
||||
Array_or_obj new_array_or_obj; // avoid copy by building new array or object in place
|
||||
|
||||
current_p_ = add_to_current( new_array_or_obj );
|
||||
}
|
||||
}
|
||||
|
||||
void end_compound()
|
||||
{
|
||||
if( current_p_ != &value_ )
|
||||
{
|
||||
current_p_ = stack_.back();
|
||||
|
||||
stack_.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
Value_type* add_to_current( const Value_type& value )
|
||||
{
|
||||
if( current_p_ == 0 )
|
||||
{
|
||||
return add_first( value );
|
||||
}
|
||||
else if( current_p_->type() == array_type )
|
||||
{
|
||||
current_p_->get_array().push_back( value );
|
||||
|
||||
return ¤t_p_->get_array().back();
|
||||
}
|
||||
|
||||
assert( current_p_->type() == obj_type );
|
||||
|
||||
return &Config_type::add( current_p_->get_obj(), name_, value );
|
||||
}
|
||||
|
||||
Value_type& value_; // this is the object or array that is being created
|
||||
Value_type* current_p_; // the child object or array that is currently being constructed
|
||||
|
||||
std::vector< Value_type* > stack_; // previous child objects and arrays
|
||||
|
||||
String_type name_; // of current name/value pair
|
||||
};
|
||||
|
||||
template< typename Iter_type >
|
||||
void throw_error( spirit_namespace::position_iterator< Iter_type > i, const std::string& reason )
|
||||
{
|
||||
throw Error_position( i.get_position().line, i.get_position().column, reason );
|
||||
}
|
||||
|
||||
template< typename Iter_type >
|
||||
void throw_error( Iter_type i, const std::string& reason )
|
||||
{
|
||||
throw reason;
|
||||
}
|
||||
|
||||
// the spirit grammer
|
||||
//
|
||||
template< class Value_type, class Iter_type >
|
||||
class Json_grammer : public spirit_namespace::grammar< Json_grammer< Value_type, Iter_type > >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Semantic_actions< Value_type, Iter_type > Semantic_actions_t;
|
||||
|
||||
Json_grammer( Semantic_actions_t& semantic_actions )
|
||||
: actions_( semantic_actions )
|
||||
{
|
||||
}
|
||||
|
||||
static void throw_not_value( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "not a value" );
|
||||
}
|
||||
|
||||
static void throw_not_array( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "not an array" );
|
||||
}
|
||||
|
||||
static void throw_not_object( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "not an object" );
|
||||
}
|
||||
|
||||
static void throw_not_pair( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "not a pair" );
|
||||
}
|
||||
|
||||
static void throw_not_colon( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "no colon in pair" );
|
||||
}
|
||||
|
||||
static void throw_not_string( Iter_type begin, Iter_type end )
|
||||
{
|
||||
throw_error( begin, "not a string" );
|
||||
}
|
||||
|
||||
template< typename ScannerT >
|
||||
class definition
|
||||
{
|
||||
public:
|
||||
|
||||
definition( const Json_grammer& self )
|
||||
{
|
||||
using namespace spirit_namespace;
|
||||
|
||||
typedef typename Value_type::String_type::value_type Char_type;
|
||||
|
||||
// first we convert the semantic action class methods to functors with the
|
||||
// parameter signature expected by spirit
|
||||
|
||||
typedef boost::function< void( Char_type ) > Char_action;
|
||||
typedef boost::function< void( Iter_type, Iter_type ) > Str_action;
|
||||
typedef boost::function< void( double ) > Real_action;
|
||||
typedef boost::function< void( boost::int64_t ) > Int_action;
|
||||
typedef boost::function< void( boost::uint64_t ) > Uint64_action;
|
||||
|
||||
Char_action begin_obj ( boost::bind( &Semantic_actions_t::begin_obj, &self.actions_, _1 ) );
|
||||
Char_action end_obj ( boost::bind( &Semantic_actions_t::end_obj, &self.actions_, _1 ) );
|
||||
Char_action begin_array( boost::bind( &Semantic_actions_t::begin_array, &self.actions_, _1 ) );
|
||||
Char_action end_array ( boost::bind( &Semantic_actions_t::end_array, &self.actions_, _1 ) );
|
||||
Str_action new_name ( boost::bind( &Semantic_actions_t::new_name, &self.actions_, _1, _2 ) );
|
||||
Str_action new_str ( boost::bind( &Semantic_actions_t::new_str, &self.actions_, _1, _2 ) );
|
||||
Str_action new_true ( boost::bind( &Semantic_actions_t::new_true, &self.actions_, _1, _2 ) );
|
||||
Str_action new_false ( boost::bind( &Semantic_actions_t::new_false, &self.actions_, _1, _2 ) );
|
||||
Str_action new_null ( boost::bind( &Semantic_actions_t::new_null, &self.actions_, _1, _2 ) );
|
||||
Real_action new_real ( boost::bind( &Semantic_actions_t::new_real, &self.actions_, _1 ) );
|
||||
Int_action new_int ( boost::bind( &Semantic_actions_t::new_int, &self.actions_, _1 ) );
|
||||
Uint64_action new_uint64 ( boost::bind( &Semantic_actions_t::new_uint64, &self.actions_, _1 ) );
|
||||
|
||||
// actual grammer
|
||||
|
||||
json_
|
||||
= value_ | eps_p[ &throw_not_value ]
|
||||
;
|
||||
|
||||
value_
|
||||
= string_[ new_str ]
|
||||
| number_
|
||||
| object_
|
||||
| array_
|
||||
| str_p( "true" ) [ new_true ]
|
||||
| str_p( "false" )[ new_false ]
|
||||
| str_p( "null" ) [ new_null ]
|
||||
;
|
||||
|
||||
object_
|
||||
= ch_p('{')[ begin_obj ]
|
||||
>> !members_
|
||||
>> ( ch_p('}')[ end_obj ] | eps_p[ &throw_not_object ] )
|
||||
;
|
||||
|
||||
members_
|
||||
= pair_ >> *( ',' >> pair_ )
|
||||
;
|
||||
|
||||
pair_
|
||||
= string_[ new_name ]
|
||||
>> ( ':' | eps_p[ &throw_not_colon ] )
|
||||
>> ( value_ | eps_p[ &throw_not_value ] )
|
||||
;
|
||||
|
||||
array_
|
||||
= ch_p('[')[ begin_array ]
|
||||
>> !elements_
|
||||
>> ( ch_p(']')[ end_array ] | eps_p[ &throw_not_array ] )
|
||||
;
|
||||
|
||||
elements_
|
||||
= value_ >> *( ',' >> value_ )
|
||||
;
|
||||
|
||||
string_
|
||||
= lexeme_d // this causes white space inside a string to be retained
|
||||
[
|
||||
confix_p
|
||||
(
|
||||
'"',
|
||||
*lex_escape_ch_p,
|
||||
'"'
|
||||
)
|
||||
]
|
||||
;
|
||||
|
||||
number_
|
||||
= strict_real_p[ new_real ]
|
||||
| int64_p [ new_int ]
|
||||
| uint64_p [ new_uint64 ]
|
||||
;
|
||||
}
|
||||
|
||||
spirit_namespace::rule< ScannerT > json_, object_, members_, pair_, array_, elements_, value_, string_, number_;
|
||||
|
||||
const spirit_namespace::rule< ScannerT >& start() const { return json_; }
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Json_grammer& operator=( const Json_grammer& ); // to prevent "assignment operator could not be generated" warning
|
||||
|
||||
Semantic_actions_t& actions_;
|
||||
};
|
||||
|
||||
template< class Iter_type, class Value_type >
|
||||
Iter_type read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value )
|
||||
{
|
||||
Semantic_actions< Value_type, Iter_type > semantic_actions( value );
|
||||
|
||||
const spirit_namespace::parse_info< Iter_type > info =
|
||||
spirit_namespace::parse( begin, end,
|
||||
Json_grammer< Value_type, Iter_type >( semantic_actions ),
|
||||
spirit_namespace::space_p );
|
||||
|
||||
if( !info.hit )
|
||||
{
|
||||
assert( false ); // in theory exception should already have been thrown
|
||||
throw_error( info.stop, "error" );
|
||||
}
|
||||
|
||||
return info.stop;
|
||||
}
|
||||
|
||||
template< class Iter_type, class Value_type >
|
||||
void add_posn_iter_and_read_range_or_throw( Iter_type begin, Iter_type end, Value_type& value )
|
||||
{
|
||||
typedef spirit_namespace::position_iterator< Iter_type > Posn_iter_t;
|
||||
|
||||
const Posn_iter_t posn_begin( begin, end );
|
||||
const Posn_iter_t posn_end( end, end );
|
||||
|
||||
read_range_or_throw( posn_begin, posn_end, value );
|
||||
}
|
||||
|
||||
template< class Iter_type, class Value_type >
|
||||
bool read_range( Iter_type& begin, Iter_type end, Value_type& value )
|
||||
{
|
||||
try
|
||||
{
|
||||
begin = read_range_or_throw( begin, end, value );
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template< class String_type, class Value_type >
|
||||
void read_string_or_throw( const String_type& s, Value_type& value )
|
||||
{
|
||||
add_posn_iter_and_read_range_or_throw( s.begin(), s.end(), value );
|
||||
}
|
||||
|
||||
template< class String_type, class Value_type >
|
||||
bool read_string( const String_type& s, Value_type& value )
|
||||
{
|
||||
typename String_type::const_iterator begin = s.begin();
|
||||
|
||||
return read_range( begin, s.end(), value );
|
||||
}
|
||||
|
||||
template< class Istream_type >
|
||||
struct Multi_pass_iters
|
||||
{
|
||||
typedef typename Istream_type::char_type Char_type;
|
||||
typedef std::istream_iterator< Char_type, Char_type > istream_iter;
|
||||
typedef spirit_namespace::multi_pass< istream_iter > Mp_iter;
|
||||
|
||||
Multi_pass_iters( Istream_type& is )
|
||||
{
|
||||
is.unsetf( std::ios::skipws );
|
||||
|
||||
begin_ = spirit_namespace::make_multi_pass( istream_iter( is ) );
|
||||
end_ = spirit_namespace::make_multi_pass( istream_iter() );
|
||||
}
|
||||
|
||||
Mp_iter begin_;
|
||||
Mp_iter end_;
|
||||
};
|
||||
|
||||
template< class Istream_type, class Value_type >
|
||||
bool read_stream( Istream_type& is, Value_type& value )
|
||||
{
|
||||
Multi_pass_iters< Istream_type > mp_iters( is );
|
||||
|
||||
return read_range( mp_iters.begin_, mp_iters.end_, value );
|
||||
}
|
||||
|
||||
template< class Istream_type, class Value_type >
|
||||
void read_stream_or_throw( Istream_type& is, Value_type& value )
|
||||
{
|
||||
const Multi_pass_iters< Istream_type > mp_iters( is );
|
||||
|
||||
add_posn_iter_and_read_range_or_throw( mp_iters.begin_, mp_iters.end_, value );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
70
src/json/json_spirit_stream_reader.h
Normal file
70
src/json/json_spirit_stream_reader.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef JSON_SPIRIT_READ_STREAM
|
||||
#define JSON_SPIRIT_READ_STREAM
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_reader_template.h"
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
// these classes allows you to read multiple top level contiguous values from a stream,
|
||||
// the normal stream read functions have a bug that prevent multiple top level values
|
||||
// from being read unless they are separated by spaces
|
||||
|
||||
template< class Istream_type, class Value_type >
|
||||
class Stream_reader
|
||||
{
|
||||
public:
|
||||
|
||||
Stream_reader( Istream_type& is )
|
||||
: iters_( is )
|
||||
{
|
||||
}
|
||||
|
||||
bool read_next( Value_type& value )
|
||||
{
|
||||
return read_range( iters_.begin_, iters_.end_, value );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typedef Multi_pass_iters< Istream_type > Mp_iters;
|
||||
|
||||
Mp_iters iters_;
|
||||
};
|
||||
|
||||
template< class Istream_type, class Value_type >
|
||||
class Stream_reader_thrower
|
||||
{
|
||||
public:
|
||||
|
||||
Stream_reader_thrower( Istream_type& is )
|
||||
: iters_( is )
|
||||
, posn_begin_( iters_.begin_, iters_.end_ )
|
||||
, posn_end_( iters_.end_, iters_.end_ )
|
||||
{
|
||||
}
|
||||
|
||||
void read_next( Value_type& value )
|
||||
{
|
||||
posn_begin_ = read_range_or_throw( posn_begin_, posn_end_, value );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
typedef Multi_pass_iters< Istream_type > Mp_iters;
|
||||
typedef spirit_namespace::position_iterator< typename Mp_iters::Mp_iter > Posn_iter_t;
|
||||
|
||||
Mp_iters iters_;
|
||||
Posn_iter_t posn_begin_, posn_end_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
61
src/json/json_spirit_utils.h
Normal file
61
src/json/json_spirit_utils.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef JSON_SPIRIT_UTILS
|
||||
#define JSON_SPIRIT_UTILS
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include <map>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
template< class Obj_t, class Map_t >
|
||||
void obj_to_map( const Obj_t& obj, Map_t& mp_obj )
|
||||
{
|
||||
mp_obj.clear();
|
||||
|
||||
for( typename Obj_t::const_iterator i = obj.begin(); i != obj.end(); ++i )
|
||||
{
|
||||
mp_obj[ i->name_ ] = i->value_;
|
||||
}
|
||||
}
|
||||
|
||||
template< class Obj_t, class Map_t >
|
||||
void map_to_obj( const Map_t& mp_obj, Obj_t& obj )
|
||||
{
|
||||
obj.clear();
|
||||
|
||||
for( typename Map_t::const_iterator i = mp_obj.begin(); i != mp_obj.end(); ++i )
|
||||
{
|
||||
obj.push_back( typename Obj_t::value_type( i->first, i->second ) );
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::map< std::string, Value > Mapped_obj;
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
typedef std::map< std::wstring, wValue > wMapped_obj;
|
||||
#endif
|
||||
|
||||
template< class Object_type, class String_type >
|
||||
const typename Object_type::value_type::Value_type& find_value( const Object_type& obj, const String_type& name )
|
||||
{
|
||||
for( typename Object_type::const_iterator i = obj.begin(); i != obj.end(); ++i )
|
||||
{
|
||||
if( i->name_ == name )
|
||||
{
|
||||
return i->value_;
|
||||
}
|
||||
}
|
||||
|
||||
return Object_type::value_type::Value_type::null;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
8
src/json/json_spirit_value.cpp
Normal file
8
src/json/json_spirit_value.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
/* Copyright (c) 2007 John W Wilkinson
|
||||
|
||||
This source code can be used for any purpose as long as
|
||||
this comment is retained. */
|
||||
|
||||
// json spirit version 2.00
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
534
src/json/json_spirit_value.h
Normal file
534
src/json/json_spirit_value.h
Normal file
@@ -0,0 +1,534 @@
|
||||
#ifndef JSON_SPIRIT_VALUE
|
||||
#define JSON_SPIRIT_VALUE
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
enum Value_type{ obj_type, array_type, str_type, bool_type, int_type, real_type, null_type };
|
||||
static const char* Value_type_name[]={"obj", "array", "str", "bool", "int", "real", "null"};
|
||||
|
||||
template< class Config > // Config determines whether the value uses std::string or std::wstring and
|
||||
// whether JSON Objects are represented as vectors or maps
|
||||
class Value_impl
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Config Config_type;
|
||||
typedef typename Config::String_type String_type;
|
||||
typedef typename Config::Object_type Object;
|
||||
typedef typename Config::Array_type Array;
|
||||
typedef typename String_type::const_pointer Const_str_ptr; // eg const char*
|
||||
|
||||
Value_impl(); // creates null value
|
||||
Value_impl( Const_str_ptr value );
|
||||
Value_impl( const String_type& value );
|
||||
Value_impl( const Object& value );
|
||||
Value_impl( const Array& value );
|
||||
Value_impl( bool value );
|
||||
Value_impl( int value );
|
||||
Value_impl( boost::int64_t value );
|
||||
Value_impl( boost::uint64_t value );
|
||||
Value_impl( double value );
|
||||
|
||||
Value_impl( const Value_impl& other );
|
||||
|
||||
bool operator==( const Value_impl& lhs ) const;
|
||||
|
||||
Value_impl& operator=( const Value_impl& lhs );
|
||||
|
||||
Value_type type() const;
|
||||
|
||||
bool is_uint64() const;
|
||||
bool is_null() const;
|
||||
|
||||
const String_type& get_str() const;
|
||||
const Object& get_obj() const;
|
||||
const Array& get_array() const;
|
||||
bool get_bool() const;
|
||||
int get_int() const;
|
||||
boost::int64_t get_int64() const;
|
||||
boost::uint64_t get_uint64() const;
|
||||
double get_real() const;
|
||||
|
||||
Object& get_obj();
|
||||
Array& get_array();
|
||||
|
||||
template< typename T > T get_value() const; // example usage: int i = value.get_value< int >();
|
||||
// or double d = value.get_value< double >();
|
||||
|
||||
static const Value_impl null;
|
||||
|
||||
private:
|
||||
|
||||
void check_type( const Value_type vtype ) const;
|
||||
|
||||
typedef boost::variant< String_type,
|
||||
boost::recursive_wrapper< Object >, boost::recursive_wrapper< Array >,
|
||||
bool, boost::int64_t, double > Variant;
|
||||
|
||||
Value_type type_;
|
||||
Variant v_;
|
||||
bool is_uint64_;
|
||||
};
|
||||
|
||||
// vector objects
|
||||
|
||||
template< class Config >
|
||||
struct Pair_impl
|
||||
{
|
||||
typedef typename Config::String_type String_type;
|
||||
typedef typename Config::Value_type Value_type;
|
||||
|
||||
Pair_impl( const String_type& name, const Value_type& value );
|
||||
|
||||
bool operator==( const Pair_impl& lhs ) const;
|
||||
|
||||
String_type name_;
|
||||
Value_type value_;
|
||||
};
|
||||
|
||||
template< class String >
|
||||
struct Config_vector
|
||||
{
|
||||
typedef String String_type;
|
||||
typedef Value_impl< Config_vector > Value_type;
|
||||
typedef Pair_impl < Config_vector > Pair_type;
|
||||
typedef std::vector< Value_type > Array_type;
|
||||
typedef std::vector< Pair_type > Object_type;
|
||||
|
||||
static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
|
||||
{
|
||||
obj.push_back( Pair_type( name , value ) );
|
||||
|
||||
return obj.back().value_;
|
||||
}
|
||||
|
||||
static String_type get_name( const Pair_type& pair )
|
||||
{
|
||||
return pair.name_;
|
||||
}
|
||||
|
||||
static Value_type get_value( const Pair_type& pair )
|
||||
{
|
||||
return pair.value_;
|
||||
}
|
||||
};
|
||||
|
||||
// typedefs for ASCII
|
||||
|
||||
typedef Config_vector< std::string > Config;
|
||||
|
||||
typedef Config::Value_type Value;
|
||||
typedef Config::Pair_type Pair;
|
||||
typedef Config::Object_type Object;
|
||||
typedef Config::Array_type Array;
|
||||
|
||||
// typedefs for Unicode
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
typedef Config_vector< std::wstring > wConfig;
|
||||
|
||||
typedef wConfig::Value_type wValue;
|
||||
typedef wConfig::Pair_type wPair;
|
||||
typedef wConfig::Object_type wObject;
|
||||
typedef wConfig::Array_type wArray;
|
||||
#endif
|
||||
|
||||
// map objects
|
||||
|
||||
template< class String >
|
||||
struct Config_map
|
||||
{
|
||||
typedef String String_type;
|
||||
typedef Value_impl< Config_map > Value_type;
|
||||
typedef std::vector< Value_type > Array_type;
|
||||
typedef std::map< String_type, Value_type > Object_type;
|
||||
typedef typename Object_type::value_type Pair_type;
|
||||
|
||||
static Value_type& add( Object_type& obj, const String_type& name, const Value_type& value )
|
||||
{
|
||||
return obj[ name ] = value;
|
||||
}
|
||||
|
||||
static String_type get_name( const Pair_type& pair )
|
||||
{
|
||||
return pair.first;
|
||||
}
|
||||
|
||||
static Value_type get_value( const Pair_type& pair )
|
||||
{
|
||||
return pair.second;
|
||||
}
|
||||
};
|
||||
|
||||
// typedefs for ASCII
|
||||
|
||||
typedef Config_map< std::string > mConfig;
|
||||
|
||||
typedef mConfig::Value_type mValue;
|
||||
typedef mConfig::Object_type mObject;
|
||||
typedef mConfig::Array_type mArray;
|
||||
|
||||
// typedefs for Unicode
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
typedef Config_map< std::wstring > wmConfig;
|
||||
|
||||
typedef wmConfig::Value_type wmValue;
|
||||
typedef wmConfig::Object_type wmObject;
|
||||
typedef wmConfig::Array_type wmArray;
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// implementation
|
||||
|
||||
template< class Config >
|
||||
const Value_impl< Config > Value_impl< Config >::null;
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl()
|
||||
: type_( null_type )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( const Const_str_ptr value )
|
||||
: type_( str_type )
|
||||
, v_( String_type( value ) )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( const String_type& value )
|
||||
: type_( str_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( const Object& value )
|
||||
: type_( obj_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( const Array& value )
|
||||
: type_( array_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( bool value )
|
||||
: type_( bool_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( int value )
|
||||
: type_( int_type )
|
||||
, v_( static_cast< boost::int64_t >( value ) )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( boost::int64_t value )
|
||||
: type_( int_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( boost::uint64_t value )
|
||||
: type_( int_type )
|
||||
, v_( static_cast< boost::int64_t >( value ) )
|
||||
, is_uint64_( true )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( double value )
|
||||
: type_( real_type )
|
||||
, v_( value )
|
||||
, is_uint64_( false )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >::Value_impl( const Value_impl< Config >& other )
|
||||
: type_( other.type() )
|
||||
, v_( other.v_ )
|
||||
, is_uint64_( other.is_uint64_ )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_impl< Config >& Value_impl< Config >::operator=( const Value_impl& lhs )
|
||||
{
|
||||
Value_impl tmp( lhs );
|
||||
|
||||
std::swap( type_, tmp.type_ );
|
||||
std::swap( v_, tmp.v_ );
|
||||
std::swap( is_uint64_, tmp.is_uint64_ );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
bool Value_impl< Config >::operator==( const Value_impl& lhs ) const
|
||||
{
|
||||
if( this == &lhs ) return true;
|
||||
|
||||
if( type() != lhs.type() ) return false;
|
||||
|
||||
return v_ == lhs.v_;
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Value_type Value_impl< Config >::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
bool Value_impl< Config >::is_uint64() const
|
||||
{
|
||||
return is_uint64_;
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
bool Value_impl< Config >::is_null() const
|
||||
{
|
||||
return type() == null_type;
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
void Value_impl< Config >::check_type( const Value_type vtype ) const
|
||||
{
|
||||
if( type() != vtype )
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
||||
///// Bitcoin: Tell the types by name instead of by number
|
||||
os << "value is type " << Value_type_name[type()] << ", expected " << Value_type_name[vtype];
|
||||
|
||||
throw std::runtime_error( os.str() );
|
||||
}
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
const typename Config::String_type& Value_impl< Config >::get_str() const
|
||||
{
|
||||
check_type( str_type );
|
||||
|
||||
return *boost::get< String_type >( &v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
const typename Value_impl< Config >::Object& Value_impl< Config >::get_obj() const
|
||||
{
|
||||
check_type( obj_type );
|
||||
|
||||
return *boost::get< Object >( &v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
const typename Value_impl< Config >::Array& Value_impl< Config >::get_array() const
|
||||
{
|
||||
check_type( array_type );
|
||||
|
||||
return *boost::get< Array >( &v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
bool Value_impl< Config >::get_bool() const
|
||||
{
|
||||
check_type( bool_type );
|
||||
|
||||
return boost::get< bool >( v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
int Value_impl< Config >::get_int() const
|
||||
{
|
||||
check_type( int_type );
|
||||
|
||||
return static_cast< int >( get_int64() );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
boost::int64_t Value_impl< Config >::get_int64() const
|
||||
{
|
||||
check_type( int_type );
|
||||
|
||||
return boost::get< boost::int64_t >( v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
boost::uint64_t Value_impl< Config >::get_uint64() const
|
||||
{
|
||||
check_type( int_type );
|
||||
|
||||
return static_cast< boost::uint64_t >( get_int64() );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
double Value_impl< Config >::get_real() const
|
||||
{
|
||||
if( type() == int_type )
|
||||
{
|
||||
return is_uint64() ? static_cast< double >( get_uint64() )
|
||||
: static_cast< double >( get_int64() );
|
||||
}
|
||||
|
||||
check_type( real_type );
|
||||
|
||||
return boost::get< double >( v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
typename Value_impl< Config >::Object& Value_impl< Config >::get_obj()
|
||||
{
|
||||
check_type( obj_type );
|
||||
|
||||
return *boost::get< Object >( &v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
typename Value_impl< Config >::Array& Value_impl< Config >::get_array()
|
||||
{
|
||||
check_type( array_type );
|
||||
|
||||
return *boost::get< Array >( &v_ );
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
Pair_impl< Config >::Pair_impl( const String_type& name, const Value_type& value )
|
||||
: name_( name )
|
||||
, value_( value )
|
||||
{
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
bool Pair_impl< Config >::operator==( const Pair_impl< Config >& lhs ) const
|
||||
{
|
||||
if( this == &lhs ) return true;
|
||||
|
||||
return ( name_ == lhs.name_ ) && ( value_ == lhs.value_ );
|
||||
}
|
||||
|
||||
// converts a C string, ie. 8 bit char array, to a string object
|
||||
//
|
||||
template < class String_type >
|
||||
String_type to_str( const char* c_str )
|
||||
{
|
||||
String_type result;
|
||||
|
||||
for( const char* p = c_str; *p != 0; ++p )
|
||||
{
|
||||
result += *p;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
namespace internal_
|
||||
{
|
||||
template< typename T >
|
||||
struct Type_to_type
|
||||
{
|
||||
};
|
||||
|
||||
template< class Value >
|
||||
int get_value( const Value& value, Type_to_type< int > )
|
||||
{
|
||||
return value.get_int();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
boost::int64_t get_value( const Value& value, Type_to_type< boost::int64_t > )
|
||||
{
|
||||
return value.get_int64();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
boost::uint64_t get_value( const Value& value, Type_to_type< boost::uint64_t > )
|
||||
{
|
||||
return value.get_uint64();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
double get_value( const Value& value, Type_to_type< double > )
|
||||
{
|
||||
return value.get_real();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
typename Value::String_type get_value( const Value& value, Type_to_type< typename Value::String_type > )
|
||||
{
|
||||
return value.get_str();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
typename Value::Array get_value( const Value& value, Type_to_type< typename Value::Array > )
|
||||
{
|
||||
return value.get_array();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
typename Value::Object get_value( const Value& value, Type_to_type< typename Value::Object > )
|
||||
{
|
||||
return value.get_obj();
|
||||
}
|
||||
|
||||
template< class Value >
|
||||
bool get_value( const Value& value, Type_to_type< bool > )
|
||||
{
|
||||
return value.get_bool();
|
||||
}
|
||||
}
|
||||
|
||||
template< class Config >
|
||||
template< typename T >
|
||||
T Value_impl< Config >::get_value() const
|
||||
{
|
||||
return internal_::get_value( *this, internal_::Type_to_type< T >() );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
95
src/json/json_spirit_writer.cpp
Normal file
95
src/json/json_spirit_writer.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#include "json_spirit_writer.h"
|
||||
#include "json_spirit_writer_template.h"
|
||||
|
||||
void json_spirit::write( const Value& value, std::ostream& os )
|
||||
{
|
||||
write_stream( value, os, false );
|
||||
}
|
||||
|
||||
void json_spirit::write_formatted( const Value& value, std::ostream& os )
|
||||
{
|
||||
write_stream( value, os, true );
|
||||
}
|
||||
|
||||
std::string json_spirit::write( const Value& value )
|
||||
{
|
||||
return write_string( value, false );
|
||||
}
|
||||
|
||||
std::string json_spirit::write_formatted( const Value& value )
|
||||
{
|
||||
return write_string( value, true );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
void json_spirit::write( const wValue& value, std::wostream& os )
|
||||
{
|
||||
write_stream( value, os, false );
|
||||
}
|
||||
|
||||
void json_spirit::write_formatted( const wValue& value, std::wostream& os )
|
||||
{
|
||||
write_stream( value, os, true );
|
||||
}
|
||||
|
||||
std::wstring json_spirit::write( const wValue& value )
|
||||
{
|
||||
return write_string( value, false );
|
||||
}
|
||||
|
||||
std::wstring json_spirit::write_formatted( const wValue& value )
|
||||
{
|
||||
return write_string( value, true );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void json_spirit::write( const mValue& value, std::ostream& os )
|
||||
{
|
||||
write_stream( value, os, false );
|
||||
}
|
||||
|
||||
void json_spirit::write_formatted( const mValue& value, std::ostream& os )
|
||||
{
|
||||
write_stream( value, os, true );
|
||||
}
|
||||
|
||||
std::string json_spirit::write( const mValue& value )
|
||||
{
|
||||
return write_string( value, false );
|
||||
}
|
||||
|
||||
std::string json_spirit::write_formatted( const mValue& value )
|
||||
{
|
||||
return write_string( value, true );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
void json_spirit::write( const wmValue& value, std::wostream& os )
|
||||
{
|
||||
write_stream( value, os, false );
|
||||
}
|
||||
|
||||
void json_spirit::write_formatted( const wmValue& value, std::wostream& os )
|
||||
{
|
||||
write_stream( value, os, true );
|
||||
}
|
||||
|
||||
std::wstring json_spirit::write( const wmValue& value )
|
||||
{
|
||||
return write_string( value, false );
|
||||
}
|
||||
|
||||
std::wstring json_spirit::write_formatted( const wmValue& value )
|
||||
{
|
||||
return write_string( value, true );
|
||||
}
|
||||
|
||||
#endif
|
||||
50
src/json/json_spirit_writer.h
Normal file
50
src/json/json_spirit_writer.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef JSON_SPIRIT_WRITER
|
||||
#define JSON_SPIRIT_WRITER
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
// functions to convert JSON Values to text,
|
||||
// the "formatted" versions add whitespace to format the output nicely
|
||||
|
||||
void write ( const Value& value, std::ostream& os );
|
||||
void write_formatted( const Value& value, std::ostream& os );
|
||||
std::string write ( const Value& value );
|
||||
std::string write_formatted( const Value& value );
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
void write ( const wValue& value, std::wostream& os );
|
||||
void write_formatted( const wValue& value, std::wostream& os );
|
||||
std::wstring write ( const wValue& value );
|
||||
std::wstring write_formatted( const wValue& value );
|
||||
|
||||
#endif
|
||||
|
||||
void write ( const mValue& value, std::ostream& os );
|
||||
void write_formatted( const mValue& value, std::ostream& os );
|
||||
std::string write ( const mValue& value );
|
||||
std::string write_formatted( const mValue& value );
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
|
||||
void write ( const wmValue& value, std::wostream& os );
|
||||
void write_formatted( const wmValue& value, std::wostream& os );
|
||||
std::wstring write ( const wmValue& value );
|
||||
std::wstring write_formatted( const wmValue& value );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
248
src/json/json_spirit_writer_template.h
Normal file
248
src/json/json_spirit_writer_template.h
Normal file
@@ -0,0 +1,248 @@
|
||||
#ifndef JSON_SPIRIT_WRITER_TEMPLATE
|
||||
#define JSON_SPIRIT_WRITER_TEMPLATE
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
inline char to_hex_char( unsigned int c )
|
||||
{
|
||||
assert( c <= 0xF );
|
||||
|
||||
const char ch = static_cast< char >( c );
|
||||
|
||||
if( ch < 10 ) return '0' + ch;
|
||||
|
||||
return 'A' - 10 + ch;
|
||||
}
|
||||
|
||||
template< class String_type >
|
||||
String_type non_printable_to_string( unsigned int c )
|
||||
{
|
||||
typedef typename String_type::value_type Char_type;
|
||||
|
||||
String_type result( 6, '\\' );
|
||||
|
||||
result[1] = 'u';
|
||||
|
||||
result[ 5 ] = to_hex_char( c & 0x000F ); c >>= 4;
|
||||
result[ 4 ] = to_hex_char( c & 0x000F ); c >>= 4;
|
||||
result[ 3 ] = to_hex_char( c & 0x000F ); c >>= 4;
|
||||
result[ 2 ] = to_hex_char( c & 0x000F );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template< typename Char_type, class String_type >
|
||||
bool add_esc_char( Char_type c, String_type& s )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
case '"': s += to_str< String_type >( "\\\"" ); return true;
|
||||
case '\\': s += to_str< String_type >( "\\\\" ); return true;
|
||||
case '\b': s += to_str< String_type >( "\\b" ); return true;
|
||||
case '\f': s += to_str< String_type >( "\\f" ); return true;
|
||||
case '\n': s += to_str< String_type >( "\\n" ); return true;
|
||||
case '\r': s += to_str< String_type >( "\\r" ); return true;
|
||||
case '\t': s += to_str< String_type >( "\\t" ); return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template< class String_type >
|
||||
String_type add_esc_chars( const String_type& s )
|
||||
{
|
||||
typedef typename String_type::const_iterator Iter_type;
|
||||
typedef typename String_type::value_type Char_type;
|
||||
|
||||
String_type result;
|
||||
|
||||
const Iter_type end( s.end() );
|
||||
|
||||
for( Iter_type i = s.begin(); i != end; ++i )
|
||||
{
|
||||
const Char_type c( *i );
|
||||
|
||||
if( add_esc_char( c, result ) ) continue;
|
||||
|
||||
const wint_t unsigned_c( ( c >= 0 ) ? c : 256 + c );
|
||||
|
||||
if( iswprint( unsigned_c ) )
|
||||
{
|
||||
result += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += non_printable_to_string< String_type >( unsigned_c );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// this class generates the JSON text,
|
||||
// it keeps track of the indentation level etc.
|
||||
//
|
||||
template< class Value_type, class Ostream_type >
|
||||
class Generator
|
||||
{
|
||||
typedef typename Value_type::Config_type Config_type;
|
||||
typedef typename Config_type::String_type String_type;
|
||||
typedef typename Config_type::Object_type Object_type;
|
||||
typedef typename Config_type::Array_type Array_type;
|
||||
typedef typename String_type::value_type Char_type;
|
||||
typedef typename Object_type::value_type Obj_member_type;
|
||||
|
||||
public:
|
||||
|
||||
Generator( const Value_type& value, Ostream_type& os, bool pretty )
|
||||
: os_( os )
|
||||
, indentation_level_( 0 )
|
||||
, pretty_( pretty )
|
||||
{
|
||||
output( value );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void output( const Value_type& value )
|
||||
{
|
||||
switch( value.type() )
|
||||
{
|
||||
case obj_type: output( value.get_obj() ); break;
|
||||
case array_type: output( value.get_array() ); break;
|
||||
case str_type: output( value.get_str() ); break;
|
||||
case bool_type: output( value.get_bool() ); break;
|
||||
case int_type: output_int( value ); break;
|
||||
|
||||
/// Bitcoin: Added std::fixed and changed precision from 16 to 8
|
||||
case real_type: os_ << std::showpoint << std::fixed << std::setprecision(8)
|
||||
<< value.get_real(); break;
|
||||
|
||||
case null_type: os_ << "null"; break;
|
||||
default: assert( false );
|
||||
}
|
||||
}
|
||||
|
||||
void output( const Object_type& obj )
|
||||
{
|
||||
output_array_or_obj( obj, '{', '}' );
|
||||
}
|
||||
|
||||
void output( const Array_type& arr )
|
||||
{
|
||||
output_array_or_obj( arr, '[', ']' );
|
||||
}
|
||||
|
||||
void output( const Obj_member_type& member )
|
||||
{
|
||||
output( Config_type::get_name( member ) ); space();
|
||||
os_ << ':'; space();
|
||||
output( Config_type::get_value( member ) );
|
||||
}
|
||||
|
||||
void output_int( const Value_type& value )
|
||||
{
|
||||
if( value.is_uint64() )
|
||||
{
|
||||
os_ << value.get_uint64();
|
||||
}
|
||||
else
|
||||
{
|
||||
os_ << value.get_int64();
|
||||
}
|
||||
}
|
||||
|
||||
void output( const String_type& s )
|
||||
{
|
||||
os_ << '"' << add_esc_chars( s ) << '"';
|
||||
}
|
||||
|
||||
void output( bool b )
|
||||
{
|
||||
os_ << to_str< String_type >( b ? "true" : "false" );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
void output_array_or_obj( const T& t, Char_type start_char, Char_type end_char )
|
||||
{
|
||||
os_ << start_char; new_line();
|
||||
|
||||
++indentation_level_;
|
||||
|
||||
for( typename T::const_iterator i = t.begin(); i != t.end(); ++i )
|
||||
{
|
||||
indent(); output( *i );
|
||||
|
||||
typename T::const_iterator next = i;
|
||||
|
||||
if( ++next != t.end())
|
||||
{
|
||||
os_ << ',';
|
||||
}
|
||||
|
||||
new_line();
|
||||
}
|
||||
|
||||
--indentation_level_;
|
||||
|
||||
indent(); os_ << end_char;
|
||||
}
|
||||
|
||||
void indent()
|
||||
{
|
||||
if( !pretty_ ) return;
|
||||
|
||||
for( int i = 0; i < indentation_level_; ++i )
|
||||
{
|
||||
os_ << " ";
|
||||
}
|
||||
}
|
||||
|
||||
void space()
|
||||
{
|
||||
if( pretty_ ) os_ << ' ';
|
||||
}
|
||||
|
||||
void new_line()
|
||||
{
|
||||
if( pretty_ ) os_ << '\n';
|
||||
}
|
||||
|
||||
Generator& operator=( const Generator& ); // to prevent "assignment operator could not be generated" warning
|
||||
|
||||
Ostream_type& os_;
|
||||
int indentation_level_;
|
||||
bool pretty_;
|
||||
};
|
||||
|
||||
template< class Value_type, class Ostream_type >
|
||||
void write_stream( const Value_type& value, Ostream_type& os, bool pretty )
|
||||
{
|
||||
Generator< Value_type, Ostream_type >( value, os, pretty );
|
||||
}
|
||||
|
||||
template< class Value_type >
|
||||
typename Value_type::String_type write_string( const Value_type& value, bool pretty )
|
||||
{
|
||||
typedef typename Value_type::String_type::value_type Char_type;
|
||||
|
||||
std::basic_ostringstream< Char_type > os;
|
||||
|
||||
write_stream( value, os, pretty );
|
||||
|
||||
return os.str();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
168
src/key.h
Normal file
168
src/key.h
Normal file
@@ -0,0 +1,168 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
// secp160k1
|
||||
// const unsigned int PRIVATE_KEY_SIZE = 192;
|
||||
// const unsigned int PUBLIC_KEY_SIZE = 41;
|
||||
// const unsigned int SIGNATURE_SIZE = 48;
|
||||
//
|
||||
// secp192k1
|
||||
// const unsigned int PRIVATE_KEY_SIZE = 222;
|
||||
// const unsigned int PUBLIC_KEY_SIZE = 49;
|
||||
// const unsigned int SIGNATURE_SIZE = 57;
|
||||
//
|
||||
// secp224k1
|
||||
// const unsigned int PRIVATE_KEY_SIZE = 250;
|
||||
// const unsigned int PUBLIC_KEY_SIZE = 57;
|
||||
// const unsigned int SIGNATURE_SIZE = 66;
|
||||
//
|
||||
// secp256k1:
|
||||
// const unsigned int PRIVATE_KEY_SIZE = 279;
|
||||
// const unsigned int PUBLIC_KEY_SIZE = 65;
|
||||
// const unsigned int SIGNATURE_SIZE = 72;
|
||||
//
|
||||
// see www.keylength.com
|
||||
// script supports up to 75 for single byte push
|
||||
|
||||
|
||||
|
||||
class key_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit key_error(const std::string& str) : std::runtime_error(str) {}
|
||||
};
|
||||
|
||||
|
||||
// secure_allocator is defined in serialize.h
|
||||
typedef vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
|
||||
|
||||
|
||||
|
||||
class CKey
|
||||
{
|
||||
protected:
|
||||
EC_KEY* pkey;
|
||||
bool fSet;
|
||||
|
||||
public:
|
||||
CKey()
|
||||
{
|
||||
pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
|
||||
if (pkey == NULL)
|
||||
throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");
|
||||
fSet = false;
|
||||
}
|
||||
|
||||
CKey(const CKey& b)
|
||||
{
|
||||
pkey = EC_KEY_dup(b.pkey);
|
||||
if (pkey == NULL)
|
||||
throw key_error("CKey::CKey(const CKey&) : EC_KEY_dup failed");
|
||||
fSet = b.fSet;
|
||||
}
|
||||
|
||||
CKey& operator=(const CKey& b)
|
||||
{
|
||||
if (!EC_KEY_copy(pkey, b.pkey))
|
||||
throw key_error("CKey::operator=(const CKey&) : EC_KEY_copy failed");
|
||||
fSet = b.fSet;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
~CKey()
|
||||
{
|
||||
EC_KEY_free(pkey);
|
||||
}
|
||||
|
||||
bool IsNull() const
|
||||
{
|
||||
return !fSet;
|
||||
}
|
||||
|
||||
void MakeNewKey()
|
||||
{
|
||||
if (!EC_KEY_generate_key(pkey))
|
||||
throw key_error("CKey::MakeNewKey() : EC_KEY_generate_key failed");
|
||||
fSet = true;
|
||||
}
|
||||
|
||||
bool SetPrivKey(const CPrivKey& vchPrivKey)
|
||||
{
|
||||
const unsigned char* pbegin = &vchPrivKey[0];
|
||||
if (!d2i_ECPrivateKey(&pkey, &pbegin, vchPrivKey.size()))
|
||||
return false;
|
||||
fSet = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
CPrivKey GetPrivKey() const
|
||||
{
|
||||
unsigned int nSize = i2d_ECPrivateKey(pkey, NULL);
|
||||
if (!nSize)
|
||||
throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey failed");
|
||||
CPrivKey vchPrivKey(nSize, 0);
|
||||
unsigned char* pbegin = &vchPrivKey[0];
|
||||
if (i2d_ECPrivateKey(pkey, &pbegin) != nSize)
|
||||
throw key_error("CKey::GetPrivKey() : i2d_ECPrivateKey returned unexpected size");
|
||||
return vchPrivKey;
|
||||
}
|
||||
|
||||
bool SetPubKey(const vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
const unsigned char* pbegin = &vchPubKey[0];
|
||||
if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.size()))
|
||||
return false;
|
||||
fSet = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<unsigned char> GetPubKey() const
|
||||
{
|
||||
unsigned int nSize = i2o_ECPublicKey(pkey, NULL);
|
||||
if (!nSize)
|
||||
throw key_error("CKey::GetPubKey() : i2o_ECPublicKey failed");
|
||||
vector<unsigned char> vchPubKey(nSize, 0);
|
||||
unsigned char* pbegin = &vchPubKey[0];
|
||||
if (i2o_ECPublicKey(pkey, &pbegin) != nSize)
|
||||
throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size");
|
||||
return vchPubKey;
|
||||
}
|
||||
|
||||
bool Sign(uint256 hash, vector<unsigned char>& vchSig)
|
||||
{
|
||||
vchSig.clear();
|
||||
unsigned char pchSig[10000];
|
||||
unsigned int nSize = 0;
|
||||
if (!ECDSA_sign(0, (unsigned char*)&hash, sizeof(hash), pchSig, &nSize, pkey))
|
||||
return false;
|
||||
vchSig.resize(nSize);
|
||||
memcpy(&vchSig[0], pchSig, nSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Verify(uint256 hash, const vector<unsigned char>& vchSig)
|
||||
{
|
||||
// -1 = error, 0 = bad sig, 1 = good
|
||||
if (ECDSA_verify(0, (unsigned char*)&hash, sizeof(hash), &vchSig[0], vchSig.size(), pkey) != 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Sign(const CPrivKey& vchPrivKey, uint256 hash, vector<unsigned char>& vchSig)
|
||||
{
|
||||
CKey key;
|
||||
if (!key.SetPrivKey(vchPrivKey))
|
||||
return false;
|
||||
return key.Sign(hash, vchSig);
|
||||
}
|
||||
|
||||
static bool Verify(const vector<unsigned char>& vchPubKey, uint256 hash, const vector<unsigned char>& vchSig)
|
||||
{
|
||||
CKey key;
|
||||
if (!key.SetPubKey(vchPubKey))
|
||||
return false;
|
||||
return key.Verify(hash, vchSig);
|
||||
}
|
||||
};
|
||||
4028
src/main.cpp
Normal file
4028
src/main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2050
src/main.h
Normal file
2050
src/main.h
Normal file
File diff suppressed because it is too large
Load Diff
86
src/makefile.mingw
Normal file
86
src/makefile.mingw
Normal file
@@ -0,0 +1,86 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
USE_UPNP:=0
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"C:\boost-1.43.0-mgw" \
|
||||
-I"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-I"C:\openssl-1.0.0c-mgw\include" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib\mswud" \
|
||||
-I"C:\wxWidgets-2.9.1-mgw\include"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"C:\boost-1.43.0-mgw\stage\lib" \
|
||||
-L"C:\db-4.7.25.NC-mgw\build_unix" \
|
||||
-L"C:\openssl-1.0.0c-mgw" \
|
||||
-L"C:\wxWidgets-2.9.1-mgw\lib\gcc_lib"
|
||||
|
||||
WXLIBS= \
|
||||
-l wxmsw29ud_html -l wxmsw29ud_core -l wxmsw29ud_adv -l wxbase29ud -l wxtiffd -l wxjpegd -l wxpngd -l wxzlibd
|
||||
|
||||
LIBS= \
|
||||
-l boost_system-mgw45-mt-s-1_43 \
|
||||
-l boost_filesystem-mgw45-mt-s-1_43 \
|
||||
-l boost_program_options-mgw45-mt-s-1_43 \
|
||||
-l boost_thread-mgw45-mt-s-1_43 \
|
||||
-l db_cxx \
|
||||
-l eay32
|
||||
|
||||
DEFS=-DWIN32 -D__WXMSW__ -D_WINDOWS -DNOPCH
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
ifdef USE_UPNP
|
||||
INCLUDEPATHS += -I"C:\upnpc-exe-win32-20110215"
|
||||
LIBPATHS += -L"C:\upnpc-exe-win32-20110215"
|
||||
LIBS += -l miniupnpc -l iphlpapi
|
||||
DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
|
||||
endif
|
||||
|
||||
LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l shlwapi
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
g++ -c $(CFLAGS) -O3 -DCRYPTOPP_X86_ASM_AVAILABLE -o $@ $<
|
||||
|
||||
obj/ui_res.o: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
|
||||
windres $(DEFS) $(INCLUDEPATHS) -o $@ -i $<
|
||||
|
||||
bitcoin.exe: $(OBJS) obj/ui.o obj/uibase.o obj/ui_res.o
|
||||
g++ $(CFLAGS) -mwindows -Wl,--subsystem,windows -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
g++ -c $(CFLAGS) -o $@ $<
|
||||
|
||||
bitcoind.exe: $(OBJS:obj/%=obj/nogui/%) obj/ui_res.o
|
||||
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del /Q obj\nogui\*
|
||||
-del /Q cryptopp\obj\*
|
||||
-del /Q headers.h.gch
|
||||
80
src/makefile.osx
Normal file
80
src/makefile.osx
Normal file
@@ -0,0 +1,80 @@
|
||||
# Copyright (c) 2010 Laszlo Hanyecz
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Mac OS X makefile for bitcoin
|
||||
# Laszlo Hanyecz (solar@heliacal.net)
|
||||
|
||||
CXX=llvm-g++
|
||||
DEPSDIR=/Users/macosuser/bitcoin/deps
|
||||
|
||||
INCLUDEPATHS= \
|
||||
-I"$(DEPSDIR)/include"
|
||||
|
||||
LIBPATHS= \
|
||||
-L"$(DEPSDIR)/lib"
|
||||
|
||||
WXLIBS=$(shell $(DEPSDIR)/bin/wx-config --libs --static)
|
||||
|
||||
USE_UPNP:=0
|
||||
|
||||
LIBS= -dead_strip \
|
||||
$(DEPSDIR)/lib/libdb_cxx-4.8.a \
|
||||
$(DEPSDIR)/lib/libboost_system.a \
|
||||
$(DEPSDIR)/lib/libboost_filesystem.a \
|
||||
$(DEPSDIR)/lib/libboost_program_options.a \
|
||||
$(DEPSDIR)/lib/libboost_thread.a \
|
||||
$(DEPSDIR)/lib/libssl.a \
|
||||
$(DEPSDIR)/lib/libcrypto.a
|
||||
|
||||
DEFS=$(shell $(DEPSDIR)/bin/wx-config --cxxflags) -D__WXMAC_OSX__ -DNOPCH -DMSG_NOSIGNAL=0 -DUSE_SSL
|
||||
|
||||
DEBUGFLAGS=-g -DwxDEBUG_LEVEL=0
|
||||
# ppc doesn't work because we don't support big-endian
|
||||
CFLAGS=-mmacosx-version-min=10.5 -arch i386 -arch x86_64 -O3 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
ifdef USE_UPNP
|
||||
LIBS += $(DEPSDIR)/lib/libminiupnpc.a
|
||||
DEFS += -DUSE_UPNP=$(USE_UPNP)
|
||||
endif
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
$(CXX) -c $(CFLAGS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
$(CXX) -c $(CFLAGS) -O3 -DCRYPTOPP_DISABLE_ASM -o $@ $<
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o
|
||||
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
$(CXX) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%)
|
||||
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f bitcoin bitcoind
|
||||
-rm -f obj/*.o
|
||||
-rm -f obj/nogui/*.o
|
||||
-rm -f cryptopp/obj/*.o
|
||||
83
src/makefile.unix
Normal file
83
src/makefile.unix
Normal file
@@ -0,0 +1,83 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
CXX=g++
|
||||
|
||||
WXINCLUDEPATHS=$(shell wx-config --cxxflags)
|
||||
|
||||
WXLIBS=$(shell wx-config --libs)
|
||||
|
||||
USE_UPNP:=0
|
||||
|
||||
DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
|
||||
|
||||
# for boost 1.37, add -mt to the boost libraries
|
||||
LIBS= \
|
||||
-Wl,-Bstatic \
|
||||
-l boost_system \
|
||||
-l boost_filesystem \
|
||||
-l boost_program_options \
|
||||
-l boost_thread \
|
||||
-l db_cxx \
|
||||
-l ssl \
|
||||
-l crypto
|
||||
|
||||
ifdef USE_UPNP
|
||||
LIBS += -l miniupnpc
|
||||
DEFS += -DUSE_UPNP=$(USE_UPNP)
|
||||
endif
|
||||
|
||||
LIBS+= \
|
||||
-Wl,-Bdynamic \
|
||||
-l gthread-2.0 \
|
||||
-l z \
|
||||
-l dl \
|
||||
-l pthread
|
||||
|
||||
|
||||
DEBUGFLAGS=-g -D__WXDEBUG__
|
||||
CXXFLAGS=-O2 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj/util.o \
|
||||
obj/script.o \
|
||||
obj/db.o \
|
||||
obj/net.o \
|
||||
obj/irc.o \
|
||||
obj/main.o \
|
||||
obj/rpc.o \
|
||||
obj/init.o \
|
||||
cryptopp/obj/sha.o \
|
||||
cryptopp/obj/cpu.o
|
||||
|
||||
|
||||
all: bitcoin
|
||||
|
||||
|
||||
obj/%.o: %.cpp $(HEADERS)
|
||||
$(CXX) -c $(CXXFLAGS) $(WXINCLUDEPATHS) -DGUI -o $@ $<
|
||||
|
||||
cryptopp/obj/%.o: cryptopp/%.cpp
|
||||
$(CXX) -c $(CXXFLAGS) -O3 -o $@ $<
|
||||
|
||||
bitcoin: $(OBJS) obj/ui.o obj/uibase.o
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^ $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
obj/nogui/%.o: %.cpp $(HEADERS)
|
||||
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||
|
||||
bitcoind: $(OBJS:obj/%=obj/nogui/%)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f obj/*.o
|
||||
-rm -f obj/nogui/*.o
|
||||
-rm -f cryptopp/obj/*.o
|
||||
-rm -f headers.h.gch
|
||||
-rm -f bitcoin
|
||||
-rm -f bitcoind
|
||||
119
src/makefile.vc
Normal file
119
src/makefile.vc
Normal file
@@ -0,0 +1,119 @@
|
||||
# Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
INCLUDEPATHS= \
|
||||
/I"/boost" \
|
||||
/I"/db/build_windows" \
|
||||
/I"/openssl/include" \
|
||||
/I"/wxwidgets/lib/vc_lib/mswu" \
|
||||
/I"/wxwidgets/include"
|
||||
|
||||
LIBPATHS= \
|
||||
/LIBPATH:"/boost/stage/lib" \
|
||||
/LIBPATH:"/db/build_windows/Release" \
|
||||
/LIBPATH:"/openssl/lib" \
|
||||
/LIBPATH:"/wxwidgets/lib/vc_lib" \
|
||||
/NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib \
|
||||
/NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib \
|
||||
/NODEFAULTLIB:msvcrtd.lib
|
||||
|
||||
WXLIBS=wxmsw29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
|
||||
|
||||
LIBS= \
|
||||
libboost_system-vc100-mt.lib \
|
||||
libboost_filesystem-vc100-mt.lib \
|
||||
libboost_program_options-vc100-mt.lib \
|
||||
libboost_thread-vc100-mt.lib \
|
||||
libdb47s.lib \
|
||||
libeay32.lib \
|
||||
kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib ws2_32.lib shlwapi.lib
|
||||
|
||||
DEFS=/DWIN32 /D__WXMSW__ /D_WINDOWS /DNOPCH
|
||||
DEBUGFLAGS=/Os
|
||||
CFLAGS=/MD /c /nologo /EHsc /GR /Zm300 $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
|
||||
HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
|
||||
script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
|
||||
|
||||
OBJS= \
|
||||
obj\util.obj \
|
||||
obj\script.obj \
|
||||
obj\db.obj \
|
||||
obj\net.obj \
|
||||
obj\irc.obj \
|
||||
obj\main.obj \
|
||||
obj\rpc.obj \
|
||||
obj\init.obj \
|
||||
cryptopp\obj\sha.obj \
|
||||
cryptopp\obj\cpu.obj
|
||||
|
||||
|
||||
all: bitcoin.exe
|
||||
|
||||
|
||||
.cpp{obj}.obj:
|
||||
cl $(CFLAGS) /DGUI /Fo$@ %s
|
||||
|
||||
obj\util.obj: $(HEADERS)
|
||||
|
||||
obj\script.obj: $(HEADERS)
|
||||
|
||||
obj\db.obj: $(HEADERS)
|
||||
|
||||
obj\net.obj: $(HEADERS)
|
||||
|
||||
obj\irc.obj: $(HEADERS)
|
||||
|
||||
obj\main.obj: $(HEADERS)
|
||||
|
||||
obj\rpc.obj: $(HEADERS)
|
||||
|
||||
obj\init.obj: $(HEADERS)
|
||||
|
||||
obj\ui.obj: $(HEADERS)
|
||||
|
||||
obj\uibase.obj: $(HEADERS)
|
||||
|
||||
cryptopp\obj\sha.obj: cryptopp\sha.cpp
|
||||
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
|
||||
|
||||
cryptopp\obj\cpu.obj: cryptopp\cpu.cpp
|
||||
cl $(CFLAGS) /O2 /DCRYPTOPP_DISABLE_ASM /Fo$@ %s
|
||||
|
||||
obj\ui.res: ui.rc rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
|
||||
rc $(INCLUDEPATHS) $(DEFS) /Fo$@ %s
|
||||
|
||||
bitcoin.exe: $(OBJS) obj\ui.obj obj\uibase.obj obj\ui.res
|
||||
link /nologo /SUBSYSTEM:WINDOWS /OUT:$@ $(LIBPATHS) $** $(WXLIBS) $(LIBS)
|
||||
|
||||
|
||||
.cpp{obj\nogui}.obj:
|
||||
cl $(CFLAGS) /Fo$@ %s
|
||||
|
||||
obj\nogui\util.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\script.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\db.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\net.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\irc.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\main.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\rpc.obj: $(HEADERS)
|
||||
|
||||
obj\nogui\init.obj: $(HEADERS)
|
||||
|
||||
bitcoind.exe: $(OBJS:obj\=obj\nogui\) obj\ui.res
|
||||
link /nologo /OUT:$@ $(LIBPATHS) $** $(LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-del /Q obj\*
|
||||
-del /Q obj\nogui\*
|
||||
-del /Q cryptopp\obj\*
|
||||
-del /Q *.ilk
|
||||
-del /Q *.pdb
|
||||
1602
src/net.cpp
Normal file
1602
src/net.cpp
Normal file
File diff suppressed because it is too large
Load Diff
62
src/noui.h
Normal file
62
src/noui.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
typedef void wxWindow;
|
||||
#define wxYES 0x00000002
|
||||
#define wxOK 0x00000004
|
||||
#define wxNO 0x00000008
|
||||
#define wxYES_NO (wxYES|wxNO)
|
||||
#define wxCANCEL 0x00000010
|
||||
#define wxAPPLY 0x00000020
|
||||
#define wxCLOSE 0x00000040
|
||||
#define wxOK_DEFAULT 0x00000000
|
||||
#define wxYES_DEFAULT 0x00000000
|
||||
#define wxNO_DEFAULT 0x00000080
|
||||
#define wxCANCEL_DEFAULT 0x80000000
|
||||
#define wxICON_EXCLAMATION 0x00000100
|
||||
#define wxICON_HAND 0x00000200
|
||||
#define wxICON_WARNING wxICON_EXCLAMATION
|
||||
#define wxICON_ERROR wxICON_HAND
|
||||
#define wxICON_QUESTION 0x00000400
|
||||
#define wxICON_INFORMATION 0x00000800
|
||||
#define wxICON_STOP wxICON_HAND
|
||||
#define wxICON_ASTERISK wxICON_INFORMATION
|
||||
#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800)
|
||||
#define wxFORWARD 0x00001000
|
||||
#define wxBACKWARD 0x00002000
|
||||
#define wxRESET 0x00004000
|
||||
#define wxHELP 0x00008000
|
||||
#define wxMORE 0x00010000
|
||||
#define wxSETUP 0x00020000
|
||||
|
||||
inline int MyMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
printf("%s: %s\n", caption.c_str(), message.c_str());
|
||||
fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str());
|
||||
return 4;
|
||||
}
|
||||
#define wxMessageBox MyMessageBox
|
||||
|
||||
inline int ThreadSafeMessageBox(const string& message, const string& caption, int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
return MyMessageBox(message, caption, style, parent, x, y);
|
||||
}
|
||||
|
||||
inline bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CalledSetStatusBar(const string& strText, int nField)
|
||||
{
|
||||
}
|
||||
|
||||
inline void UIThreadCall(boost::function0<void> fn)
|
||||
{
|
||||
}
|
||||
|
||||
inline void MainFrameRepaint()
|
||||
{
|
||||
}
|
||||
2
src/obj/.gitignore
vendored
Normal file
2
src/obj/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
src/obj/nogui/.gitignore
vendored
Normal file
2
src/obj/nogui/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2190
src/rpc.cpp
Normal file
2190
src/rpc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
6
src/rpc.h
Normal file
6
src/rpc.h
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
void ThreadRPCServer(void* parg);
|
||||
int CommandLineRPC(int argc, char *argv[]);
|
||||
1206
src/script.cpp
Normal file
1206
src/script.cpp
Normal file
File diff suppressed because it is too large
Load Diff
709
src/script.h
Normal file
709
src/script.h
Normal file
@@ -0,0 +1,709 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
class CTransaction;
|
||||
|
||||
enum
|
||||
{
|
||||
SIGHASH_ALL = 1,
|
||||
SIGHASH_NONE = 2,
|
||||
SIGHASH_SINGLE = 3,
|
||||
SIGHASH_ANYONECANPAY = 0x80,
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum opcodetype
|
||||
{
|
||||
// push value
|
||||
OP_0=0,
|
||||
OP_FALSE=OP_0,
|
||||
OP_PUSHDATA1=76,
|
||||
OP_PUSHDATA2,
|
||||
OP_PUSHDATA4,
|
||||
OP_1NEGATE,
|
||||
OP_RESERVED,
|
||||
OP_1,
|
||||
OP_TRUE=OP_1,
|
||||
OP_2,
|
||||
OP_3,
|
||||
OP_4,
|
||||
OP_5,
|
||||
OP_6,
|
||||
OP_7,
|
||||
OP_8,
|
||||
OP_9,
|
||||
OP_10,
|
||||
OP_11,
|
||||
OP_12,
|
||||
OP_13,
|
||||
OP_14,
|
||||
OP_15,
|
||||
OP_16,
|
||||
|
||||
// control
|
||||
OP_NOP,
|
||||
OP_VER,
|
||||
OP_IF,
|
||||
OP_NOTIF,
|
||||
OP_VERIF,
|
||||
OP_VERNOTIF,
|
||||
OP_ELSE,
|
||||
OP_ENDIF,
|
||||
OP_VERIFY,
|
||||
OP_RETURN,
|
||||
|
||||
// stack ops
|
||||
OP_TOALTSTACK,
|
||||
OP_FROMALTSTACK,
|
||||
OP_2DROP,
|
||||
OP_2DUP,
|
||||
OP_3DUP,
|
||||
OP_2OVER,
|
||||
OP_2ROT,
|
||||
OP_2SWAP,
|
||||
OP_IFDUP,
|
||||
OP_DEPTH,
|
||||
OP_DROP,
|
||||
OP_DUP,
|
||||
OP_NIP,
|
||||
OP_OVER,
|
||||
OP_PICK,
|
||||
OP_ROLL,
|
||||
OP_ROT,
|
||||
OP_SWAP,
|
||||
OP_TUCK,
|
||||
|
||||
// splice ops
|
||||
OP_CAT,
|
||||
OP_SUBSTR,
|
||||
OP_LEFT,
|
||||
OP_RIGHT,
|
||||
OP_SIZE,
|
||||
|
||||
// bit logic
|
||||
OP_INVERT,
|
||||
OP_AND,
|
||||
OP_OR,
|
||||
OP_XOR,
|
||||
OP_EQUAL,
|
||||
OP_EQUALVERIFY,
|
||||
OP_RESERVED1,
|
||||
OP_RESERVED2,
|
||||
|
||||
// numeric
|
||||
OP_1ADD,
|
||||
OP_1SUB,
|
||||
OP_2MUL,
|
||||
OP_2DIV,
|
||||
OP_NEGATE,
|
||||
OP_ABS,
|
||||
OP_NOT,
|
||||
OP_0NOTEQUAL,
|
||||
|
||||
OP_ADD,
|
||||
OP_SUB,
|
||||
OP_MUL,
|
||||
OP_DIV,
|
||||
OP_MOD,
|
||||
OP_LSHIFT,
|
||||
OP_RSHIFT,
|
||||
|
||||
OP_BOOLAND,
|
||||
OP_BOOLOR,
|
||||
OP_NUMEQUAL,
|
||||
OP_NUMEQUALVERIFY,
|
||||
OP_NUMNOTEQUAL,
|
||||
OP_LESSTHAN,
|
||||
OP_GREATERTHAN,
|
||||
OP_LESSTHANOREQUAL,
|
||||
OP_GREATERTHANOREQUAL,
|
||||
OP_MIN,
|
||||
OP_MAX,
|
||||
|
||||
OP_WITHIN,
|
||||
|
||||
// crypto
|
||||
OP_RIPEMD160,
|
||||
OP_SHA1,
|
||||
OP_SHA256,
|
||||
OP_HASH160,
|
||||
OP_HASH256,
|
||||
OP_CODESEPARATOR,
|
||||
OP_CHECKSIG,
|
||||
OP_CHECKSIGVERIFY,
|
||||
OP_CHECKMULTISIG,
|
||||
OP_CHECKMULTISIGVERIFY,
|
||||
|
||||
// expansion
|
||||
OP_NOP1,
|
||||
OP_NOP2,
|
||||
OP_NOP3,
|
||||
OP_NOP4,
|
||||
OP_NOP5,
|
||||
OP_NOP6,
|
||||
OP_NOP7,
|
||||
OP_NOP8,
|
||||
OP_NOP9,
|
||||
OP_NOP10,
|
||||
|
||||
|
||||
|
||||
// template matching params
|
||||
OP_PUBKEYHASH = 0xfd,
|
||||
OP_PUBKEY = 0xfe,
|
||||
|
||||
OP_INVALIDOPCODE = 0xff,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline const char* GetOpName(opcodetype opcode)
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
// push value
|
||||
case OP_0 : return "0";
|
||||
case OP_PUSHDATA1 : return "OP_PUSHDATA1";
|
||||
case OP_PUSHDATA2 : return "OP_PUSHDATA2";
|
||||
case OP_PUSHDATA4 : return "OP_PUSHDATA4";
|
||||
case OP_1NEGATE : return "-1";
|
||||
case OP_RESERVED : return "OP_RESERVED";
|
||||
case OP_1 : return "1";
|
||||
case OP_2 : return "2";
|
||||
case OP_3 : return "3";
|
||||
case OP_4 : return "4";
|
||||
case OP_5 : return "5";
|
||||
case OP_6 : return "6";
|
||||
case OP_7 : return "7";
|
||||
case OP_8 : return "8";
|
||||
case OP_9 : return "9";
|
||||
case OP_10 : return "10";
|
||||
case OP_11 : return "11";
|
||||
case OP_12 : return "12";
|
||||
case OP_13 : return "13";
|
||||
case OP_14 : return "14";
|
||||
case OP_15 : return "15";
|
||||
case OP_16 : return "16";
|
||||
|
||||
// control
|
||||
case OP_NOP : return "OP_NOP";
|
||||
case OP_VER : return "OP_VER";
|
||||
case OP_IF : return "OP_IF";
|
||||
case OP_NOTIF : return "OP_NOTIF";
|
||||
case OP_VERIF : return "OP_VERIF";
|
||||
case OP_VERNOTIF : return "OP_VERNOTIF";
|
||||
case OP_ELSE : return "OP_ELSE";
|
||||
case OP_ENDIF : return "OP_ENDIF";
|
||||
case OP_VERIFY : return "OP_VERIFY";
|
||||
case OP_RETURN : return "OP_RETURN";
|
||||
|
||||
// stack ops
|
||||
case OP_TOALTSTACK : return "OP_TOALTSTACK";
|
||||
case OP_FROMALTSTACK : return "OP_FROMALTSTACK";
|
||||
case OP_2DROP : return "OP_2DROP";
|
||||
case OP_2DUP : return "OP_2DUP";
|
||||
case OP_3DUP : return "OP_3DUP";
|
||||
case OP_2OVER : return "OP_2OVER";
|
||||
case OP_2ROT : return "OP_2ROT";
|
||||
case OP_2SWAP : return "OP_2SWAP";
|
||||
case OP_IFDUP : return "OP_IFDUP";
|
||||
case OP_DEPTH : return "OP_DEPTH";
|
||||
case OP_DROP : return "OP_DROP";
|
||||
case OP_DUP : return "OP_DUP";
|
||||
case OP_NIP : return "OP_NIP";
|
||||
case OP_OVER : return "OP_OVER";
|
||||
case OP_PICK : return "OP_PICK";
|
||||
case OP_ROLL : return "OP_ROLL";
|
||||
case OP_ROT : return "OP_ROT";
|
||||
case OP_SWAP : return "OP_SWAP";
|
||||
case OP_TUCK : return "OP_TUCK";
|
||||
|
||||
// splice ops
|
||||
case OP_CAT : return "OP_CAT";
|
||||
case OP_SUBSTR : return "OP_SUBSTR";
|
||||
case OP_LEFT : return "OP_LEFT";
|
||||
case OP_RIGHT : return "OP_RIGHT";
|
||||
case OP_SIZE : return "OP_SIZE";
|
||||
|
||||
// bit logic
|
||||
case OP_INVERT : return "OP_INVERT";
|
||||
case OP_AND : return "OP_AND";
|
||||
case OP_OR : return "OP_OR";
|
||||
case OP_XOR : return "OP_XOR";
|
||||
case OP_EQUAL : return "OP_EQUAL";
|
||||
case OP_EQUALVERIFY : return "OP_EQUALVERIFY";
|
||||
case OP_RESERVED1 : return "OP_RESERVED1";
|
||||
case OP_RESERVED2 : return "OP_RESERVED2";
|
||||
|
||||
// numeric
|
||||
case OP_1ADD : return "OP_1ADD";
|
||||
case OP_1SUB : return "OP_1SUB";
|
||||
case OP_2MUL : return "OP_2MUL";
|
||||
case OP_2DIV : return "OP_2DIV";
|
||||
case OP_NEGATE : return "OP_NEGATE";
|
||||
case OP_ABS : return "OP_ABS";
|
||||
case OP_NOT : return "OP_NOT";
|
||||
case OP_0NOTEQUAL : return "OP_0NOTEQUAL";
|
||||
case OP_ADD : return "OP_ADD";
|
||||
case OP_SUB : return "OP_SUB";
|
||||
case OP_MUL : return "OP_MUL";
|
||||
case OP_DIV : return "OP_DIV";
|
||||
case OP_MOD : return "OP_MOD";
|
||||
case OP_LSHIFT : return "OP_LSHIFT";
|
||||
case OP_RSHIFT : return "OP_RSHIFT";
|
||||
case OP_BOOLAND : return "OP_BOOLAND";
|
||||
case OP_BOOLOR : return "OP_BOOLOR";
|
||||
case OP_NUMEQUAL : return "OP_NUMEQUAL";
|
||||
case OP_NUMEQUALVERIFY : return "OP_NUMEQUALVERIFY";
|
||||
case OP_NUMNOTEQUAL : return "OP_NUMNOTEQUAL";
|
||||
case OP_LESSTHAN : return "OP_LESSTHAN";
|
||||
case OP_GREATERTHAN : return "OP_GREATERTHAN";
|
||||
case OP_LESSTHANOREQUAL : return "OP_LESSTHANOREQUAL";
|
||||
case OP_GREATERTHANOREQUAL : return "OP_GREATERTHANOREQUAL";
|
||||
case OP_MIN : return "OP_MIN";
|
||||
case OP_MAX : return "OP_MAX";
|
||||
case OP_WITHIN : return "OP_WITHIN";
|
||||
|
||||
// crypto
|
||||
case OP_RIPEMD160 : return "OP_RIPEMD160";
|
||||
case OP_SHA1 : return "OP_SHA1";
|
||||
case OP_SHA256 : return "OP_SHA256";
|
||||
case OP_HASH160 : return "OP_HASH160";
|
||||
case OP_HASH256 : return "OP_HASH256";
|
||||
case OP_CODESEPARATOR : return "OP_CODESEPARATOR";
|
||||
case OP_CHECKSIG : return "OP_CHECKSIG";
|
||||
case OP_CHECKSIGVERIFY : return "OP_CHECKSIGVERIFY";
|
||||
case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
|
||||
case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
|
||||
|
||||
// expanson
|
||||
case OP_NOP1 : return "OP_NOP1";
|
||||
case OP_NOP2 : return "OP_NOP2";
|
||||
case OP_NOP3 : return "OP_NOP3";
|
||||
case OP_NOP4 : return "OP_NOP4";
|
||||
case OP_NOP5 : return "OP_NOP5";
|
||||
case OP_NOP6 : return "OP_NOP6";
|
||||
case OP_NOP7 : return "OP_NOP7";
|
||||
case OP_NOP8 : return "OP_NOP8";
|
||||
case OP_NOP9 : return "OP_NOP9";
|
||||
case OP_NOP10 : return "OP_NOP10";
|
||||
|
||||
|
||||
|
||||
// template matching params
|
||||
case OP_PUBKEYHASH : return "OP_PUBKEYHASH";
|
||||
case OP_PUBKEY : return "OP_PUBKEY";
|
||||
|
||||
case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE";
|
||||
default:
|
||||
return "OP_UNKNOWN";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
inline string ValueString(const vector<unsigned char>& vch)
|
||||
{
|
||||
if (vch.size() <= 4)
|
||||
return strprintf("%d", CBigNum(vch).getint());
|
||||
else
|
||||
return HexStr(vch);
|
||||
}
|
||||
|
||||
inline string StackString(const vector<vector<unsigned char> >& vStack)
|
||||
{
|
||||
string str;
|
||||
foreach(const vector<unsigned char>& vch, vStack)
|
||||
{
|
||||
if (!str.empty())
|
||||
str += " ";
|
||||
str += ValueString(vch);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CScript : public vector<unsigned char>
|
||||
{
|
||||
protected:
|
||||
CScript& push_int64(int64 n)
|
||||
{
|
||||
if (n == -1 || (n >= 1 && n <= 16))
|
||||
{
|
||||
push_back(n + (OP_1 - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
CBigNum bn(n);
|
||||
*this << bn.getvch();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& push_uint64(uint64 n)
|
||||
{
|
||||
if (n >= 1 && n <= 16)
|
||||
{
|
||||
push_back(n + (OP_1 - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
CBigNum bn(n);
|
||||
*this << bn.getvch();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
CScript() { }
|
||||
CScript(const CScript& b) : vector<unsigned char>(b.begin(), b.end()) { }
|
||||
CScript(const_iterator pbegin, const_iterator pend) : vector<unsigned char>(pbegin, pend) { }
|
||||
#ifndef _MSC_VER
|
||||
CScript(const unsigned char* pbegin, const unsigned char* pend) : vector<unsigned char>(pbegin, pend) { }
|
||||
#endif
|
||||
|
||||
CScript& operator+=(const CScript& b)
|
||||
{
|
||||
insert(end(), b.begin(), b.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend CScript operator+(const CScript& a, const CScript& b)
|
||||
{
|
||||
CScript ret = a;
|
||||
ret += b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
explicit CScript(char b) { operator<<(b); }
|
||||
explicit CScript(short b) { operator<<(b); }
|
||||
explicit CScript(int b) { operator<<(b); }
|
||||
explicit CScript(long b) { operator<<(b); }
|
||||
explicit CScript(int64 b) { operator<<(b); }
|
||||
explicit CScript(unsigned char b) { operator<<(b); }
|
||||
explicit CScript(unsigned int b) { operator<<(b); }
|
||||
explicit CScript(unsigned short b) { operator<<(b); }
|
||||
explicit CScript(unsigned long b) { operator<<(b); }
|
||||
explicit CScript(uint64 b) { operator<<(b); }
|
||||
|
||||
explicit CScript(opcodetype b) { operator<<(b); }
|
||||
explicit CScript(const uint256& b) { operator<<(b); }
|
||||
explicit CScript(const CBigNum& b) { operator<<(b); }
|
||||
explicit CScript(const vector<unsigned char>& b) { operator<<(b); }
|
||||
|
||||
|
||||
CScript& operator<<(char b) { return push_int64(b); }
|
||||
CScript& operator<<(short b) { return push_int64(b); }
|
||||
CScript& operator<<(int b) { return push_int64(b); }
|
||||
CScript& operator<<(long b) { return push_int64(b); }
|
||||
CScript& operator<<(int64 b) { return push_int64(b); }
|
||||
CScript& operator<<(unsigned char b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned int b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned short b) { return push_uint64(b); }
|
||||
CScript& operator<<(unsigned long b) { return push_uint64(b); }
|
||||
CScript& operator<<(uint64 b) { return push_uint64(b); }
|
||||
|
||||
CScript& operator<<(opcodetype opcode)
|
||||
{
|
||||
if (opcode < 0 || opcode > 0xff)
|
||||
throw runtime_error("CScript::operator<<() : invalid opcode");
|
||||
insert(end(), (unsigned char)opcode);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const uint160& b)
|
||||
{
|
||||
insert(end(), sizeof(b));
|
||||
insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const uint256& b)
|
||||
{
|
||||
insert(end(), sizeof(b));
|
||||
insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const CBigNum& b)
|
||||
{
|
||||
*this << b.getvch();
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const vector<unsigned char>& b)
|
||||
{
|
||||
if (b.size() < OP_PUSHDATA1)
|
||||
{
|
||||
insert(end(), (unsigned char)b.size());
|
||||
}
|
||||
else if (b.size() <= 0xff)
|
||||
{
|
||||
insert(end(), OP_PUSHDATA1);
|
||||
insert(end(), (unsigned char)b.size());
|
||||
}
|
||||
else if (b.size() <= 0xffff)
|
||||
{
|
||||
insert(end(), OP_PUSHDATA2);
|
||||
unsigned short nSize = b.size();
|
||||
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
insert(end(), OP_PUSHDATA4);
|
||||
unsigned int nSize = b.size();
|
||||
insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
|
||||
}
|
||||
insert(end(), b.begin(), b.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
CScript& operator<<(const CScript& b)
|
||||
{
|
||||
// I'm not sure if this should push the script or concatenate scripts.
|
||||
// If there's ever a use for pushing a script onto a script, delete this member fn
|
||||
assert(("warning: pushing a CScript onto a CScript with << is probably not intended, use + to concatenate", false));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool GetOp(iterator& pc, opcodetype& opcodeRet, vector<unsigned char>& vchRet)
|
||||
{
|
||||
// Wrapper so it can be called with either iterator or const_iterator
|
||||
const_iterator pc2 = pc;
|
||||
bool fRet = GetOp2(pc2, opcodeRet, &vchRet);
|
||||
pc = begin() + (pc2 - begin());
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool GetOp(iterator& pc, opcodetype& opcodeRet)
|
||||
{
|
||||
const_iterator pc2 = pc;
|
||||
bool fRet = GetOp2(pc2, opcodeRet, NULL);
|
||||
pc = begin() + (pc2 - begin());
|
||||
return fRet;
|
||||
}
|
||||
|
||||
bool GetOp(const_iterator& pc, opcodetype& opcodeRet, vector<unsigned char>& vchRet) const
|
||||
{
|
||||
return GetOp2(pc, opcodeRet, &vchRet);
|
||||
}
|
||||
|
||||
bool GetOp(const_iterator& pc, opcodetype& opcodeRet) const
|
||||
{
|
||||
return GetOp2(pc, opcodeRet, NULL);
|
||||
}
|
||||
|
||||
bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, vector<unsigned char>* pvchRet) const
|
||||
{
|
||||
opcodeRet = OP_INVALIDOPCODE;
|
||||
if (pvchRet)
|
||||
pvchRet->clear();
|
||||
if (pc >= end())
|
||||
return false;
|
||||
|
||||
// Read instruction
|
||||
if (end() - pc < 1)
|
||||
return false;
|
||||
unsigned int opcode = *pc++;
|
||||
|
||||
// Immediate operand
|
||||
if (opcode <= OP_PUSHDATA4)
|
||||
{
|
||||
unsigned int nSize;
|
||||
if (opcode < OP_PUSHDATA1)
|
||||
{
|
||||
nSize = opcode;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA1)
|
||||
{
|
||||
if (end() - pc < 1)
|
||||
return false;
|
||||
nSize = *pc++;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA2)
|
||||
{
|
||||
if (end() - pc < 2)
|
||||
return false;
|
||||
nSize = 0;
|
||||
memcpy(&nSize, &pc[0], 2);
|
||||
pc += 2;
|
||||
}
|
||||
else if (opcode == OP_PUSHDATA4)
|
||||
{
|
||||
if (end() - pc < 4)
|
||||
return false;
|
||||
memcpy(&nSize, &pc[0], 4);
|
||||
pc += 4;
|
||||
}
|
||||
if (end() - pc < nSize)
|
||||
return false;
|
||||
if (pvchRet)
|
||||
pvchRet->assign(pc, pc + nSize);
|
||||
pc += nSize;
|
||||
}
|
||||
|
||||
opcodeRet = (opcodetype)opcode;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void FindAndDelete(const CScript& b)
|
||||
{
|
||||
if (b.empty())
|
||||
return;
|
||||
iterator pc = begin();
|
||||
opcodetype opcode;
|
||||
do
|
||||
{
|
||||
while (end() - pc >= b.size() && memcmp(&pc[0], &b[0], b.size()) == 0)
|
||||
erase(pc, pc + b.size());
|
||||
}
|
||||
while (GetOp(pc, opcode));
|
||||
}
|
||||
|
||||
|
||||
int GetSigOpCount() const
|
||||
{
|
||||
int n = 0;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
if (!GetOp(pc, opcode))
|
||||
break;
|
||||
if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
|
||||
n++;
|
||||
else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
|
||||
n += 20;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
bool IsPushOnly() const
|
||||
{
|
||||
if (size() > 200)
|
||||
return false;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
if (!GetOp(pc, opcode))
|
||||
return false;
|
||||
if (opcode > OP_16)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint160 GetBitcoinAddressHash160() const
|
||||
{
|
||||
opcodetype opcode;
|
||||
vector<unsigned char> vch;
|
||||
CScript::const_iterator pc = begin();
|
||||
if (!GetOp(pc, opcode, vch) || opcode != OP_DUP) return 0;
|
||||
if (!GetOp(pc, opcode, vch) || opcode != OP_HASH160) return 0;
|
||||
if (!GetOp(pc, opcode, vch) || vch.size() != sizeof(uint160)) return 0;
|
||||
uint160 hash160 = uint160(vch);
|
||||
if (!GetOp(pc, opcode, vch) || opcode != OP_EQUALVERIFY) return 0;
|
||||
if (!GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG) return 0;
|
||||
if (pc != end()) return 0;
|
||||
return hash160;
|
||||
}
|
||||
|
||||
string GetBitcoinAddress() const
|
||||
{
|
||||
uint160 hash160 = GetBitcoinAddressHash160();
|
||||
if (hash160 == 0)
|
||||
return "";
|
||||
return Hash160ToAddress(hash160);
|
||||
}
|
||||
|
||||
void SetBitcoinAddress(const uint160& hash160)
|
||||
{
|
||||
this->clear();
|
||||
*this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||
}
|
||||
|
||||
void SetBitcoinAddress(const vector<unsigned char>& vchPubKey)
|
||||
{
|
||||
SetBitcoinAddress(Hash160(vchPubKey));
|
||||
}
|
||||
|
||||
bool SetBitcoinAddress(const string& strAddress)
|
||||
{
|
||||
this->clear();
|
||||
uint160 hash160;
|
||||
if (!AddressToHash160(strAddress, hash160))
|
||||
return false;
|
||||
SetBitcoinAddress(hash160);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PrintHex() const
|
||||
{
|
||||
printf("CScript(%s)\n", HexStr(begin(), end(), true).c_str());
|
||||
}
|
||||
|
||||
string ToString() const
|
||||
{
|
||||
string str;
|
||||
opcodetype opcode;
|
||||
vector<unsigned char> vch;
|
||||
const_iterator pc = begin();
|
||||
while (pc < end())
|
||||
{
|
||||
if (!str.empty())
|
||||
str += " ";
|
||||
if (!GetOp(pc, opcode, vch))
|
||||
{
|
||||
str += "[error]";
|
||||
return str;
|
||||
}
|
||||
if (0 <= opcode && opcode <= OP_PUSHDATA4)
|
||||
str += ValueString(vch);
|
||||
else
|
||||
str += GetOpName(opcode);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void print() const
|
||||
{
|
||||
printf("%s\n", ToString().c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
|
||||
bool IsStandard(const CScript& scriptPubKey);
|
||||
bool IsMine(const CScript& scriptPubKey);
|
||||
bool ExtractPubKey(const CScript& scriptPubKey, bool fMineOnly, vector<unsigned char>& vchPubKeyRet);
|
||||
bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);
|
||||
bool SignSignature(const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL, CScript scriptPrereq=CScript());
|
||||
bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType=0);
|
||||
1261
src/serialize.h
Normal file
1261
src/serialize.h
Normal file
File diff suppressed because it is too large
Load Diff
84
src/strlcpy.h
Normal file
84
src/strlcpy.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
inline size_t strlcpy(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0)
|
||||
{
|
||||
while (--n != 0)
|
||||
{
|
||||
if ((*d++ = *s++) == '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0)
|
||||
{
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
* If retval >= siz, truncation occurred.
|
||||
*/
|
||||
inline size_t strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0')
|
||||
{
|
||||
if (n != 1)
|
||||
{
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
2903
src/ui.cpp
Normal file
2903
src/ui.cpp
Normal file
File diff suppressed because it is too large
Load Diff
343
src/ui.h
Normal file
343
src/ui.h
Normal file
@@ -0,0 +1,343 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
|
||||
|
||||
|
||||
|
||||
extern wxLocale g_locale;
|
||||
|
||||
|
||||
|
||||
void HandleCtrlA(wxKeyEvent& event);
|
||||
void UIThreadCall(boost::function0<void>);
|
||||
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
|
||||
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
|
||||
void CalledSetStatusBar(const string& strText, int nField);
|
||||
void MainFrameRepaint();
|
||||
void CreateMainWindow();
|
||||
void SetStartOnSystemStartup(bool fAutoStart);
|
||||
|
||||
|
||||
|
||||
|
||||
inline int MyMessageBox(const wxString& message, const wxString& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1)
|
||||
{
|
||||
#ifdef GUI
|
||||
if (!fDaemon)
|
||||
return wxMessageBox(message, caption, style, parent, x, y);
|
||||
#endif
|
||||
printf("wxMessageBox %s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
fprintf(stderr, "%s: %s\n", string(caption).c_str(), string(message).c_str());
|
||||
return wxOK;
|
||||
}
|
||||
#define wxMessageBox MyMessageBox
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CMainFrame : public CMainFrameBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnNotebookPageChanged(wxNotebookEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnIconize(wxIconizeEvent& event);
|
||||
void OnMouseEvents(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnPaintListCtrl(wxPaintEvent& event);
|
||||
void OnMenuFileExit(wxCommandEvent& event);
|
||||
void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
|
||||
void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
|
||||
void OnMenuOptionsOptions(wxCommandEvent& event);
|
||||
void OnMenuHelpAbout(wxCommandEvent& event);
|
||||
void OnButtonSend(wxCommandEvent& event);
|
||||
void OnButtonAddressBook(wxCommandEvent& event);
|
||||
void OnSetFocusAddress(wxFocusEvent& event);
|
||||
void OnMouseEventsAddress(wxMouseEvent& event);
|
||||
void OnButtonNew(wxCommandEvent& event);
|
||||
void OnButtonCopy(wxCommandEvent& event);
|
||||
void OnListColBeginDrag(wxListEvent& event);
|
||||
void OnListItemActivated(wxListEvent& event);
|
||||
void OnListItemActivatedProductsSent(wxListEvent& event);
|
||||
void OnListItemActivatedOrdersSent(wxListEvent& event);
|
||||
void OnListItemActivatedOrdersReceived(wxListEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CMainFrame(wxWindow* parent);
|
||||
~CMainFrame();
|
||||
|
||||
// Custom
|
||||
enum
|
||||
{
|
||||
ALL = 0,
|
||||
SENTRECEIVED = 1,
|
||||
SENT = 2,
|
||||
RECEIVED = 3,
|
||||
};
|
||||
int nPage;
|
||||
wxListCtrl* m_listCtrl;
|
||||
bool fShowGenerated;
|
||||
bool fShowSent;
|
||||
bool fShowReceived;
|
||||
bool fRefreshListCtrl;
|
||||
bool fRefreshListCtrlRunning;
|
||||
bool fOnSetFocusAddress;
|
||||
unsigned int nListViewUpdated;
|
||||
bool fRefresh;
|
||||
|
||||
void OnUIThreadCall(wxCommandEvent& event);
|
||||
int GetSortIndex(const string& strSort);
|
||||
void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxColour& colour, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
|
||||
bool DeleteLine(uint256 hashKey);
|
||||
bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
|
||||
void RefreshListCtrl();
|
||||
void RefreshStatusColumn();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class CTxDetailsDialog : public CTxDetailsDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
|
||||
|
||||
// State
|
||||
CWalletTx wtx;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class COptionsDialog : public COptionsDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnListBox(wxCommandEvent& event);
|
||||
void OnKillFocusTransactionFee(wxFocusEvent& event);
|
||||
void OnCheckBoxUseProxy(wxCommandEvent& event);
|
||||
void OnKillFocusProxy(wxFocusEvent& event);
|
||||
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
void OnButtonApply(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
COptionsDialog(wxWindow* parent);
|
||||
|
||||
// Custom
|
||||
bool fTmpStartOnSystemStartup;
|
||||
bool fTmpMinimizeOnClose;
|
||||
void SelectPage(int nPage);
|
||||
CAddress GetProxyAddr();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAboutDialog : public CAboutDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CAboutDialog(wxWindow* parent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CSendDialog : public CSendDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
|
||||
void OnKillFocusAmount(wxFocusEvent& event);
|
||||
void OnButtonAddressBook(wxCommandEvent& event);
|
||||
void OnButtonPaste(wxCommandEvent& event);
|
||||
void OnButtonSend(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CSendDialog(wxWindow* parent, const wxString& strAddress="");
|
||||
|
||||
// Custom
|
||||
bool fEnabledPrev;
|
||||
string strFromSave;
|
||||
string strMessageSave;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CSendingDialog : public CSendingDialogBase
|
||||
{
|
||||
public:
|
||||
// Event handlers
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
|
||||
~CSendingDialog();
|
||||
|
||||
// State
|
||||
CAddress addr;
|
||||
int64 nPrice;
|
||||
CWalletTx wtx;
|
||||
wxDateTime start;
|
||||
char pszStatus[10000];
|
||||
bool fCanCancel;
|
||||
bool fAbort;
|
||||
bool fSuccess;
|
||||
bool fUIDone;
|
||||
bool fWorkDone;
|
||||
|
||||
void Close();
|
||||
void Repaint();
|
||||
bool Status();
|
||||
bool Status(const string& str);
|
||||
bool Error(const string& str);
|
||||
void StartTransfer();
|
||||
void OnReply2(CDataStream& vRecv);
|
||||
void OnReply3(CDataStream& vRecv);
|
||||
};
|
||||
|
||||
void SendingDialogStartTransfer(void* parg);
|
||||
void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
|
||||
void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
|
||||
|
||||
|
||||
|
||||
class CAddressBookDialog : public CAddressBookDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnNotebookPageChanged(wxNotebookEvent& event);
|
||||
void OnListEndLabelEdit(wxListEvent& event);
|
||||
void OnListItemSelected(wxListEvent& event);
|
||||
void OnListItemActivated(wxListEvent& event);
|
||||
void OnButtonDelete(wxCommandEvent& event);
|
||||
void OnButtonCopy(wxCommandEvent& event);
|
||||
void OnButtonEdit(wxCommandEvent& event);
|
||||
void OnButtonNew(wxCommandEvent& event);
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
|
||||
|
||||
// Custom
|
||||
enum
|
||||
{
|
||||
SENDING = 0,
|
||||
RECEIVING = 1,
|
||||
};
|
||||
int nPage;
|
||||
wxListCtrl* m_listCtrl;
|
||||
bool fDuringSend;
|
||||
wxString GetAddress();
|
||||
wxString GetSelectedAddress();
|
||||
wxString GetSelectedSendingAddress();
|
||||
wxString GetSelectedReceivingAddress();
|
||||
bool CheckIfMine(const string& strAddress, const string& strTitle);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnButtonOK(wxCommandEvent& event) { EndModal(true); }
|
||||
void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
|
||||
void OnClose(wxCloseEvent& event) { EndModal(false); }
|
||||
|
||||
void OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
|
||||
EndModal(true);
|
||||
else
|
||||
HandleCtrlA(event);
|
||||
}
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CGetTextFromUserDialog(wxWindow* parent,
|
||||
const string& strCaption,
|
||||
const string& strMessage1,
|
||||
const string& strValue1="",
|
||||
const string& strMessage2="",
|
||||
const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
|
||||
{
|
||||
int x = GetSize().GetWidth();
|
||||
int y = GetSize().GetHeight();
|
||||
m_staticTextMessage1->SetLabel(strMessage1);
|
||||
m_textCtrl1->SetValue(strValue1);
|
||||
y += wxString(strMessage1).Freq('\n') * 14;
|
||||
if (!strMessage2.empty())
|
||||
{
|
||||
m_staticTextMessage2->Show(true);
|
||||
m_staticTextMessage2->SetLabel(strMessage2);
|
||||
m_textCtrl2->Show(true);
|
||||
m_textCtrl2->SetValue(strValue2);
|
||||
y += 46 + wxString(strMessage2).Freq('\n') * 14;
|
||||
}
|
||||
#ifndef __WXMSW__
|
||||
x = x * 114 / 100;
|
||||
y = y * 114 / 100;
|
||||
#endif
|
||||
SetSize(x, y);
|
||||
}
|
||||
|
||||
// Custom
|
||||
string GetValue() { return (string)m_textCtrl1->GetValue(); }
|
||||
string GetValue1() { return (string)m_textCtrl1->GetValue(); }
|
||||
string GetValue2() { return (string)m_textCtrl2->GetValue(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CMyTaskBarIcon : public wxTaskBarIcon
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnLeftButtonDClick(wxTaskBarIconEvent& event);
|
||||
void OnMenuRestore(wxCommandEvent& event);
|
||||
void OnMenuSend(wxCommandEvent& event);
|
||||
void OnMenuOptions(wxCommandEvent& event);
|
||||
void OnUpdateUIGenerate(wxUpdateUIEvent& event);
|
||||
void OnMenuGenerate(wxCommandEvent& event);
|
||||
void OnMenuExit(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
CMyTaskBarIcon() : wxTaskBarIcon()
|
||||
{
|
||||
Show(true);
|
||||
}
|
||||
|
||||
void Show(bool fShow=true);
|
||||
void Hide();
|
||||
void Restore();
|
||||
void UpdateTooltip();
|
||||
virtual wxMenu* CreatePopupMenu();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
1008
src/uibase.cpp
Normal file
1008
src/uibase.cpp
Normal file
File diff suppressed because it is too large
Load Diff
421
src/uibase.h
Normal file
421
src/uibase.h
Normal file
@@ -0,0 +1,421 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 21 2009)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __uibase__
|
||||
#define __uibase__
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/toolbar.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/statbmp.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define wxID_MAINFRAME 1000
|
||||
#define wxID_BUTTONSEND 1001
|
||||
#define wxID_BUTTONRECEIVE 1002
|
||||
#define wxID_TEXTCTRLADDRESS 1003
|
||||
#define wxID_BUTTONNEW 1004
|
||||
#define wxID_BUTTONCOPY 1005
|
||||
#define wxID_PROXYIP 1006
|
||||
#define wxID_PROXYPORT 1007
|
||||
#define wxID_TRANSACTIONFEE 1008
|
||||
#define wxID_TEXTCTRLPAYTO 1009
|
||||
#define wxID_BUTTONPASTE 1010
|
||||
#define wxID_BUTTONADDRESSBOOK 1011
|
||||
#define wxID_TEXTCTRLAMOUNT 1012
|
||||
#define wxID_CHOICETRANSFERTYPE 1013
|
||||
#define wxID_LISTCTRL 1014
|
||||
#define wxID_BUTTONRENAME 1015
|
||||
#define wxID_PANELSENDING 1016
|
||||
#define wxID_LISTCTRLSENDING 1017
|
||||
#define wxID_PANELRECEIVING 1018
|
||||
#define wxID_LISTCTRLRECEIVING 1019
|
||||
#define wxID_BUTTONDELETE 1020
|
||||
#define wxID_BUTTONEDIT 1021
|
||||
#define wxID_TEXTCTRL 1022
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CMainFrameBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CMainFrameBase : public wxFrame
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_menubar;
|
||||
wxMenu* m_menuFile;
|
||||
wxMenu* m_menuHelp;
|
||||
wxToolBar* m_toolBar;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxButton* m_buttonNew;
|
||||
wxButton* m_buttonCopy;
|
||||
|
||||
wxStaticText* m_staticText41;
|
||||
wxStaticText* m_staticTextBalance;
|
||||
|
||||
wxChoice* m_choiceFilter;
|
||||
wxNotebook* m_notebook;
|
||||
wxPanel* m_panel9;
|
||||
wxPanel* m_panel91;
|
||||
wxPanel* m_panel92;
|
||||
wxPanel* m_panel93;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
|
||||
virtual void OnMouseEvents( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnMenuFileExit( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMenuOptionsChangeYourAddress( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMenuOptionsOptions( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnMenuHelpAbout( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonSend( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonAddressBook( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
|
||||
virtual void OnMouseEventsAddress( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetFocusAddress( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); }
|
||||
virtual void OnListColBeginDrag( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintListCtrl( wxPaintEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxMenu* m_menuOptions;
|
||||
wxStatusBar* m_statusBar;
|
||||
wxTextCtrl* m_textCtrlAddress;
|
||||
wxListCtrl* m_listCtrlAll;
|
||||
wxListCtrl* m_listCtrlSentReceived;
|
||||
wxListCtrl* m_listCtrlSent;
|
||||
wxListCtrl* m_listCtrlReceived;
|
||||
|
||||
CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 723,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
~CMainFrameBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CTxDetailsDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CTxDetailsDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxHtmlWindow* m_htmlWin;
|
||||
wxButton* m_buttonOK;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
CTxDetailsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Transaction Details"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,450 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~CTxDetailsDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class COptionsDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class COptionsDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxListBox* m_listBox;
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxPanel* m_panelMain;
|
||||
|
||||
wxCheckBox* m_checkBoxStartOnSystemStartup;
|
||||
wxCheckBox* m_checkBoxMinimizeToTray;
|
||||
wxCheckBox* m_checkBoxUseUPnP;
|
||||
wxCheckBox* m_checkBoxMinimizeOnClose;
|
||||
wxCheckBox* m_checkBoxUseProxy;
|
||||
|
||||
wxStaticText* m_staticTextProxyIP;
|
||||
wxTextCtrl* m_textCtrlProxyIP;
|
||||
wxStaticText* m_staticTextProxyPort;
|
||||
wxTextCtrl* m_textCtrlProxyPort;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_textCtrlTransactionFee;
|
||||
wxPanel* m_panelTest2;
|
||||
|
||||
wxStaticText* m_staticText321;
|
||||
wxStaticText* m_staticText69;
|
||||
wxButton* m_buttonOK;
|
||||
wxButton* m_buttonCancel;
|
||||
wxButton* m_buttonApply;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnListBox( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCheckBoxMinimizeToTray( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCheckBoxUseProxy( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnKillFocusProxy( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnKillFocusTransactionFee( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonApply( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
COptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 540,360 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~COptionsDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CAboutDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CAboutDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_bitmap;
|
||||
|
||||
wxStaticText* m_staticText40;
|
||||
|
||||
wxStaticText* m_staticTextMain;
|
||||
|
||||
|
||||
wxButton* m_buttonOK;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxStaticText* m_staticTextVersion;
|
||||
|
||||
CAboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 532,333 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~CAboutDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CSendDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CSendDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
wxStaticText* m_staticTextInstructions;
|
||||
|
||||
wxStaticBitmap* m_bitmapCheckMark;
|
||||
wxStaticText* m_staticText36;
|
||||
wxTextCtrl* m_textCtrlAddress;
|
||||
wxButton* m_buttonPaste;
|
||||
wxButton* m_buttonAddress;
|
||||
wxStaticText* m_staticText19;
|
||||
wxTextCtrl* m_textCtrlAmount;
|
||||
wxStaticText* m_staticText20;
|
||||
wxChoice* m_choiceTransferType;
|
||||
|
||||
|
||||
|
||||
wxButton* m_buttonSend;
|
||||
wxButton* m_buttonCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
|
||||
virtual void OnTextAddress( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonPaste( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonAddressBook( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnKillFocusAmount( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonSend( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
CSendDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Send Coins"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 498,157 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~CSendDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CSendingDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CSendingDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextSending;
|
||||
wxTextCtrl* m_textCtrlStatus;
|
||||
|
||||
wxButton* m_buttonOK;
|
||||
wxButton* m_buttonCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
CSendingDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sending..."), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 442,151 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~CSendingDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CYourAddressDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CYourAddressDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
wxStaticText* m_staticText45;
|
||||
wxListCtrl* m_listCtrl;
|
||||
|
||||
wxButton* m_buttonRename;
|
||||
wxButton* m_buttonNew;
|
||||
wxButton* m_buttonCopy;
|
||||
wxButton* m_buttonOK;
|
||||
wxButton* m_buttonCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnListEndLabelEdit( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonRename( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
CYourAddressDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Your Bitcoin Addresses"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~CYourAddressDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CAddressBookDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CAddressBookDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook;
|
||||
wxPanel* m_panelSending;
|
||||
|
||||
wxStaticText* m_staticText55;
|
||||
wxListCtrl* m_listCtrlSending;
|
||||
wxPanel* m_panelReceiving;
|
||||
|
||||
wxStaticText* m_staticText45;
|
||||
|
||||
wxListCtrl* m_listCtrlReceiving;
|
||||
|
||||
wxButton* m_buttonDelete;
|
||||
wxButton* m_buttonCopy;
|
||||
wxButton* m_buttonEdit;
|
||||
wxButton* m_buttonNew;
|
||||
wxButton* m_buttonOK;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnNotebookPageChanged( wxNotebookEvent& event ) { event.Skip(); }
|
||||
virtual void OnListEndLabelEdit( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemActivated( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonDelete( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCopy( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonEdit( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonNew( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxButton* m_buttonCancel;
|
||||
|
||||
CAddressBookDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Address Book"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 610,390 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~CAddressBookDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CGetTextFromUserDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class CGetTextFromUserDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
wxStaticText* m_staticTextMessage1;
|
||||
wxTextCtrl* m_textCtrl1;
|
||||
wxStaticText* m_staticTextMessage2;
|
||||
wxTextCtrl* m_textCtrl2;
|
||||
|
||||
|
||||
wxButton* m_buttonOK;
|
||||
wxButton* m_buttonCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnKeyDown( wxKeyEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonOK( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
CGetTextFromUserDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 440,138 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~CGetTextFromUserDialogBase();
|
||||
|
||||
};
|
||||
|
||||
#endif //__uibase__
|
||||
757
src/uint256.h
Normal file
757
src/uint256.h
Normal file
@@ -0,0 +1,757 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <limits.h>
|
||||
#include <string>
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
#else
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||
#define for if (false) ; else for
|
||||
#endif
|
||||
|
||||
|
||||
inline int Testuint256AdHoc(vector<string> vArg);
|
||||
|
||||
|
||||
|
||||
// We have to keep a separate base class without constructors
|
||||
// so the compiler will let us use it in a union
|
||||
template<unsigned int BITS>
|
||||
class base_uint
|
||||
{
|
||||
protected:
|
||||
enum { WIDTH=BITS/32 };
|
||||
unsigned int pn[WIDTH];
|
||||
public:
|
||||
|
||||
bool operator!() const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
if (pn[i] != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
const base_uint operator~() const
|
||||
{
|
||||
base_uint ret;
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
ret.pn[i] = ~pn[i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
const base_uint operator-() const
|
||||
{
|
||||
base_uint ret;
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
ret.pn[i] = ~pn[i];
|
||||
ret++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
base_uint& operator=(uint64 b)
|
||||
{
|
||||
pn[0] = (unsigned int)b;
|
||||
pn[1] = (unsigned int)(b >> 32);
|
||||
for (int i = 2; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator^=(const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] ^= b.pn[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator&=(const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] &= b.pn[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator|=(const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] |= b.pn[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator^=(uint64 b)
|
||||
{
|
||||
pn[0] ^= (unsigned int)b;
|
||||
pn[1] ^= (unsigned int)(b >> 32);
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator&=(uint64 b)
|
||||
{
|
||||
pn[0] &= (unsigned int)b;
|
||||
pn[1] &= (unsigned int)(b >> 32);
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator|=(uint64 b)
|
||||
{
|
||||
pn[0] |= (unsigned int)b;
|
||||
pn[1] |= (unsigned int)(b >> 32);
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator<<=(unsigned int shift)
|
||||
{
|
||||
base_uint a(*this);
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
int k = shift / 32;
|
||||
shift = shift % 32;
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
{
|
||||
if (i+k+1 < WIDTH && shift != 0)
|
||||
pn[i+k+1] |= (a.pn[i] >> (32-shift));
|
||||
if (i+k < WIDTH)
|
||||
pn[i+k] |= (a.pn[i] << shift);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator>>=(unsigned int shift)
|
||||
{
|
||||
base_uint a(*this);
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
int k = shift / 32;
|
||||
shift = shift % 32;
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
{
|
||||
if (i-k-1 >= 0 && shift != 0)
|
||||
pn[i-k-1] |= (a.pn[i] << (32-shift));
|
||||
if (i-k >= 0)
|
||||
pn[i-k] |= (a.pn[i] >> shift);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator+=(const base_uint& b)
|
||||
{
|
||||
uint64 carry = 0;
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
{
|
||||
uint64 n = carry + pn[i] + b.pn[i];
|
||||
pn[i] = n & 0xffffffff;
|
||||
carry = n >> 32;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator-=(const base_uint& b)
|
||||
{
|
||||
*this += -b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator+=(uint64 b64)
|
||||
{
|
||||
base_uint b;
|
||||
b = b64;
|
||||
*this += b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator-=(uint64 b64)
|
||||
{
|
||||
base_uint b;
|
||||
b = b64;
|
||||
*this += -b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
base_uint& operator++()
|
||||
{
|
||||
// prefix operator
|
||||
int i = 0;
|
||||
while (++pn[i] == 0 && i < WIDTH-1)
|
||||
i++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
++(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator--()
|
||||
{
|
||||
// prefix operator
|
||||
int i = 0;
|
||||
while (--pn[i] == -1 && i < WIDTH-1)
|
||||
i++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
--(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
friend inline bool operator<(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
for (int i = base_uint::WIDTH-1; i >= 0; i--)
|
||||
{
|
||||
if (a.pn[i] < b.pn[i])
|
||||
return true;
|
||||
else if (a.pn[i] > b.pn[i])
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
friend inline bool operator<=(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
for (int i = base_uint::WIDTH-1; i >= 0; i--)
|
||||
{
|
||||
if (a.pn[i] < b.pn[i])
|
||||
return true;
|
||||
else if (a.pn[i] > b.pn[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
friend inline bool operator>(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
for (int i = base_uint::WIDTH-1; i >= 0; i--)
|
||||
{
|
||||
if (a.pn[i] > b.pn[i])
|
||||
return true;
|
||||
else if (a.pn[i] < b.pn[i])
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
friend inline bool operator>=(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
for (int i = base_uint::WIDTH-1; i >= 0; i--)
|
||||
{
|
||||
if (a.pn[i] > b.pn[i])
|
||||
return true;
|
||||
else if (a.pn[i] < b.pn[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
friend inline bool operator==(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < base_uint::WIDTH; i++)
|
||||
if (a.pn[i] != b.pn[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
friend inline bool operator==(const base_uint& a, uint64 b)
|
||||
{
|
||||
if (a.pn[0] != (unsigned int)b)
|
||||
return false;
|
||||
if (a.pn[1] != (unsigned int)(b >> 32))
|
||||
return false;
|
||||
for (int i = 2; i < base_uint::WIDTH; i++)
|
||||
if (a.pn[i] != 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return (!(a == b));
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const base_uint& a, uint64 b)
|
||||
{
|
||||
return (!(a == b));
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string GetHex() const
|
||||
{
|
||||
char psz[sizeof(pn)*2 + 1];
|
||||
for (int i = 0; i < sizeof(pn); i++)
|
||||
sprintf(psz + i*2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]);
|
||||
return string(psz, psz + sizeof(pn)*2);
|
||||
}
|
||||
|
||||
void SetHex(const char* psz)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
|
||||
// skip leading spaces
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
|
||||
// skip 0x
|
||||
if (psz[0] == '0' && tolower(psz[1]) == 'x')
|
||||
psz += 2;
|
||||
|
||||
// hex string to uint
|
||||
static char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
|
||||
const char* pbegin = psz;
|
||||
while (phexdigit[*psz] || *psz == '0')
|
||||
psz++;
|
||||
psz--;
|
||||
unsigned char* p1 = (unsigned char*)pn;
|
||||
unsigned char* pend = p1 + WIDTH * 4;
|
||||
while (psz >= pbegin && p1 < pend)
|
||||
{
|
||||
*p1 = phexdigit[(unsigned char)*psz--];
|
||||
if (psz >= pbegin)
|
||||
{
|
||||
*p1 |= (phexdigit[(unsigned char)*psz--] << 4);
|
||||
p1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SetHex(const std::string& str)
|
||||
{
|
||||
SetHex(str.c_str());
|
||||
}
|
||||
|
||||
std::string ToString() const
|
||||
{
|
||||
return (GetHex());
|
||||
}
|
||||
|
||||
unsigned char* begin()
|
||||
{
|
||||
return (unsigned char*)&pn[0];
|
||||
}
|
||||
|
||||
unsigned char* end()
|
||||
{
|
||||
return (unsigned char*)&pn[WIDTH];
|
||||
}
|
||||
|
||||
unsigned int size()
|
||||
{
|
||||
return sizeof(pn);
|
||||
}
|
||||
|
||||
|
||||
unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
return sizeof(pn);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const
|
||||
{
|
||||
s.write((char*)pn, sizeof(pn));
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize(Stream& s, int nType=0, int nVersion=VERSION)
|
||||
{
|
||||
s.read((char*)pn, sizeof(pn));
|
||||
}
|
||||
|
||||
|
||||
friend class uint160;
|
||||
friend class uint256;
|
||||
friend inline int Testuint256AdHoc(vector<string> vArg);
|
||||
};
|
||||
|
||||
typedef base_uint<160> base_uint160;
|
||||
typedef base_uint<256> base_uint256;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// uint160 and uint256 could be implemented as templates, but to keep
|
||||
// compile errors and debugging cleaner, they're copy and pasted.
|
||||
//
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// uint160
|
||||
//
|
||||
|
||||
class uint160 : public base_uint160
|
||||
{
|
||||
public:
|
||||
typedef base_uint160 basetype;
|
||||
|
||||
uint160()
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint160(const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
}
|
||||
|
||||
uint160& operator=(const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint160(uint64 b)
|
||||
{
|
||||
pn[0] = (unsigned int)b;
|
||||
pn[1] = (unsigned int)(b >> 32);
|
||||
for (int i = 2; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint160& operator=(uint64 b)
|
||||
{
|
||||
pn[0] = (unsigned int)b;
|
||||
pn[1] = (unsigned int)(b >> 32);
|
||||
for (int i = 2; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint160(const std::string& str)
|
||||
{
|
||||
SetHex(str);
|
||||
}
|
||||
|
||||
explicit uint160(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
if (vch.size() == sizeof(pn))
|
||||
memcpy(pn, &vch[0], sizeof(pn));
|
||||
else
|
||||
*this = 0;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const uint160& a, uint64 b) { return (base_uint160)a == b; }
|
||||
inline bool operator!=(const uint160& a, uint64 b) { return (base_uint160)a != b; }
|
||||
inline const uint160 operator<<(const base_uint160& a, unsigned int shift) { return uint160(a) <<= shift; }
|
||||
inline const uint160 operator>>(const base_uint160& a, unsigned int shift) { return uint160(a) >>= shift; }
|
||||
inline const uint160 operator<<(const uint160& a, unsigned int shift) { return uint160(a) <<= shift; }
|
||||
inline const uint160 operator>>(const uint160& a, unsigned int shift) { return uint160(a) >>= shift; }
|
||||
|
||||
inline const uint160 operator^(const base_uint160& a, const base_uint160& b) { return uint160(a) ^= b; }
|
||||
inline const uint160 operator&(const base_uint160& a, const base_uint160& b) { return uint160(a) &= b; }
|
||||
inline const uint160 operator|(const base_uint160& a, const base_uint160& b) { return uint160(a) |= b; }
|
||||
inline const uint160 operator+(const base_uint160& a, const base_uint160& b) { return uint160(a) += b; }
|
||||
inline const uint160 operator-(const base_uint160& a, const base_uint160& b) { return uint160(a) -= b; }
|
||||
|
||||
inline bool operator<(const base_uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; }
|
||||
inline bool operator<=(const base_uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; }
|
||||
inline bool operator>(const base_uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; }
|
||||
inline bool operator>=(const base_uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; }
|
||||
inline bool operator==(const base_uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; }
|
||||
inline bool operator!=(const base_uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; }
|
||||
inline const uint160 operator^(const base_uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
|
||||
inline const uint160 operator&(const base_uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; }
|
||||
inline const uint160 operator|(const base_uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; }
|
||||
inline const uint160 operator+(const base_uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; }
|
||||
inline const uint160 operator-(const base_uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; }
|
||||
|
||||
inline bool operator<(const uint160& a, const base_uint160& b) { return (base_uint160)a < (base_uint160)b; }
|
||||
inline bool operator<=(const uint160& a, const base_uint160& b) { return (base_uint160)a <= (base_uint160)b; }
|
||||
inline bool operator>(const uint160& a, const base_uint160& b) { return (base_uint160)a > (base_uint160)b; }
|
||||
inline bool operator>=(const uint160& a, const base_uint160& b) { return (base_uint160)a >= (base_uint160)b; }
|
||||
inline bool operator==(const uint160& a, const base_uint160& b) { return (base_uint160)a == (base_uint160)b; }
|
||||
inline bool operator!=(const uint160& a, const base_uint160& b) { return (base_uint160)a != (base_uint160)b; }
|
||||
inline const uint160 operator^(const uint160& a, const base_uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
|
||||
inline const uint160 operator&(const uint160& a, const base_uint160& b) { return (base_uint160)a & (base_uint160)b; }
|
||||
inline const uint160 operator|(const uint160& a, const base_uint160& b) { return (base_uint160)a | (base_uint160)b; }
|
||||
inline const uint160 operator+(const uint160& a, const base_uint160& b) { return (base_uint160)a + (base_uint160)b; }
|
||||
inline const uint160 operator-(const uint160& a, const base_uint160& b) { return (base_uint160)a - (base_uint160)b; }
|
||||
|
||||
inline bool operator<(const uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; }
|
||||
inline bool operator<=(const uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; }
|
||||
inline bool operator>(const uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; }
|
||||
inline bool operator>=(const uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; }
|
||||
inline bool operator==(const uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; }
|
||||
inline bool operator!=(const uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; }
|
||||
inline const uint160 operator^(const uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
|
||||
inline const uint160 operator&(const uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; }
|
||||
inline const uint160 operator|(const uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; }
|
||||
inline const uint160 operator+(const uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; }
|
||||
inline const uint160 operator-(const uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// uint256
|
||||
//
|
||||
|
||||
class uint256 : public base_uint256
|
||||
{
|
||||
public:
|
||||
typedef base_uint256 basetype;
|
||||
|
||||
uint256()
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint256(const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
}
|
||||
|
||||
uint256& operator=(const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint256(uint64 b)
|
||||
{
|
||||
pn[0] = (unsigned int)b;
|
||||
pn[1] = (unsigned int)(b >> 32);
|
||||
for (int i = 2; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
}
|
||||
|
||||
uint256& operator=(uint64 b)
|
||||
{
|
||||
pn[0] = (unsigned int)b;
|
||||
pn[1] = (unsigned int)(b >> 32);
|
||||
for (int i = 2; i < WIDTH; i++)
|
||||
pn[i] = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint256(const std::string& str)
|
||||
{
|
||||
SetHex(str);
|
||||
}
|
||||
|
||||
explicit uint256(const std::vector<unsigned char>& vch)
|
||||
{
|
||||
if (vch.size() == sizeof(pn))
|
||||
memcpy(pn, &vch[0], sizeof(pn));
|
||||
else
|
||||
*this = 0;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const uint256& a, uint64 b) { return (base_uint256)a == b; }
|
||||
inline bool operator!=(const uint256& a, uint64 b) { return (base_uint256)a != b; }
|
||||
inline const uint256 operator<<(const base_uint256& a, unsigned int shift) { return uint256(a) <<= shift; }
|
||||
inline const uint256 operator>>(const base_uint256& a, unsigned int shift) { return uint256(a) >>= shift; }
|
||||
inline const uint256 operator<<(const uint256& a, unsigned int shift) { return uint256(a) <<= shift; }
|
||||
inline const uint256 operator>>(const uint256& a, unsigned int shift) { return uint256(a) >>= shift; }
|
||||
|
||||
inline const uint256 operator^(const base_uint256& a, const base_uint256& b) { return uint256(a) ^= b; }
|
||||
inline const uint256 operator&(const base_uint256& a, const base_uint256& b) { return uint256(a) &= b; }
|
||||
inline const uint256 operator|(const base_uint256& a, const base_uint256& b) { return uint256(a) |= b; }
|
||||
inline const uint256 operator+(const base_uint256& a, const base_uint256& b) { return uint256(a) += b; }
|
||||
inline const uint256 operator-(const base_uint256& a, const base_uint256& b) { return uint256(a) -= b; }
|
||||
|
||||
inline bool operator<(const base_uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; }
|
||||
inline bool operator<=(const base_uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; }
|
||||
inline bool operator>(const base_uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; }
|
||||
inline bool operator>=(const base_uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; }
|
||||
inline bool operator==(const base_uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; }
|
||||
inline bool operator!=(const base_uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; }
|
||||
inline const uint256 operator^(const base_uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
|
||||
inline const uint256 operator&(const base_uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; }
|
||||
inline const uint256 operator|(const base_uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; }
|
||||
inline const uint256 operator+(const base_uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
|
||||
inline const uint256 operator-(const base_uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
|
||||
|
||||
inline bool operator<(const uint256& a, const base_uint256& b) { return (base_uint256)a < (base_uint256)b; }
|
||||
inline bool operator<=(const uint256& a, const base_uint256& b) { return (base_uint256)a <= (base_uint256)b; }
|
||||
inline bool operator>(const uint256& a, const base_uint256& b) { return (base_uint256)a > (base_uint256)b; }
|
||||
inline bool operator>=(const uint256& a, const base_uint256& b) { return (base_uint256)a >= (base_uint256)b; }
|
||||
inline bool operator==(const uint256& a, const base_uint256& b) { return (base_uint256)a == (base_uint256)b; }
|
||||
inline bool operator!=(const uint256& a, const base_uint256& b) { return (base_uint256)a != (base_uint256)b; }
|
||||
inline const uint256 operator^(const uint256& a, const base_uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
|
||||
inline const uint256 operator&(const uint256& a, const base_uint256& b) { return (base_uint256)a & (base_uint256)b; }
|
||||
inline const uint256 operator|(const uint256& a, const base_uint256& b) { return (base_uint256)a | (base_uint256)b; }
|
||||
inline const uint256 operator+(const uint256& a, const base_uint256& b) { return (base_uint256)a + (base_uint256)b; }
|
||||
inline const uint256 operator-(const uint256& a, const base_uint256& b) { return (base_uint256)a - (base_uint256)b; }
|
||||
|
||||
inline bool operator<(const uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; }
|
||||
inline bool operator<=(const uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; }
|
||||
inline bool operator>(const uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; }
|
||||
inline bool operator>=(const uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; }
|
||||
inline bool operator==(const uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; }
|
||||
inline bool operator!=(const uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; }
|
||||
inline const uint256 operator^(const uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
|
||||
inline const uint256 operator&(const uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; }
|
||||
inline const uint256 operator|(const uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; }
|
||||
inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
|
||||
inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline int Testuint256AdHoc(vector<string> vArg)
|
||||
{
|
||||
uint256 g(0);
|
||||
|
||||
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g--; printf("g--\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g--; printf("g--\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g++; printf("g++\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g++; printf("g++\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g++; printf("g++\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
g++; printf("g++\n");
|
||||
printf("%s\n", g.ToString().c_str());
|
||||
|
||||
|
||||
|
||||
uint256 a(7);
|
||||
printf("a=7\n");
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
|
||||
uint256 b;
|
||||
printf("b undefined\n");
|
||||
printf("%s\n", b.ToString().c_str());
|
||||
int c = 3;
|
||||
|
||||
a = c;
|
||||
a.pn[3] = 15;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
uint256 k(c);
|
||||
|
||||
a = 5;
|
||||
a.pn[3] = 15;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
b = 1;
|
||||
b <<= 52;
|
||||
|
||||
a |= b;
|
||||
|
||||
a ^= 0x500;
|
||||
|
||||
printf("a %s\n", a.ToString().c_str());
|
||||
|
||||
a = a | b | (uint256)0x1000;
|
||||
|
||||
|
||||
printf("a %s\n", a.ToString().c_str());
|
||||
printf("b %s\n", b.ToString().c_str());
|
||||
|
||||
a = 0xfffffffe;
|
||||
a.pn[4] = 9;
|
||||
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a++;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a++;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a++;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a++;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
|
||||
a--;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a--;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a--;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
uint256 d = a--;
|
||||
printf("%s\n", d.ToString().c_str());
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a--;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
a--;
|
||||
printf("%s\n", a.ToString().c_str());
|
||||
|
||||
d = a;
|
||||
|
||||
printf("%s\n", d.ToString().c_str());
|
||||
for (int i = uint256::WIDTH-1; i >= 0; i--) printf("%08x", d.pn[i]); printf("\n");
|
||||
|
||||
uint256 neg = d;
|
||||
neg = ~neg;
|
||||
printf("%s\n", neg.ToString().c_str());
|
||||
|
||||
|
||||
uint256 e = uint256("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
printf("\n");
|
||||
printf("%s\n", e.ToString().c_str());
|
||||
|
||||
|
||||
printf("\n");
|
||||
uint256 x1 = uint256("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
uint256 x2;
|
||||
printf("%s\n", x1.ToString().c_str());
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
x2 = x1 << i;
|
||||
printf("%s\n", x2.ToString().c_str());
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("%s\n", x1.ToString().c_str());
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
x2 = x1;
|
||||
x2 >>= i;
|
||||
printf("%s\n", x2.ToString().c_str());
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256(0) >> i);
|
||||
printf("%s\n", k.ToString().c_str());
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256(0) << i);
|
||||
printf("%s\n", k.ToString().c_str());
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
905
src/util.cpp
Normal file
905
src/util.cpp
Normal file
@@ -0,0 +1,905 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "headers.h"
|
||||
|
||||
|
||||
map<string, string> mapArgs;
|
||||
map<string, vector<string> > mapMultiArgs;
|
||||
bool fDebug = false;
|
||||
bool fPrintToConsole = false;
|
||||
bool fPrintToDebugger = false;
|
||||
char pszSetDataDir[MAX_PATH] = "";
|
||||
bool fRequestShutdown = false;
|
||||
bool fShutdown = false;
|
||||
bool fDaemon = false;
|
||||
bool fServer = false;
|
||||
bool fCommandLine = false;
|
||||
string strMiscWarning;
|
||||
bool fTestNet = false;
|
||||
bool fNoListen = false;
|
||||
bool fLogTimestamps = false;
|
||||
|
||||
|
||||
|
||||
|
||||
// Workaround for "multiple definition of `_tls_used'"
|
||||
// http://svn.boost.org/trac/boost/ticket/4258
|
||||
extern "C" void tss_cleanup_implemented() { }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Init openssl library multithreading support
|
||||
static boost::interprocess::interprocess_mutex** ppmutexOpenSSL;
|
||||
void locking_callback(int mode, int i, const char* file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
ppmutexOpenSSL[i]->lock();
|
||||
else
|
||||
ppmutexOpenSSL[i]->unlock();
|
||||
}
|
||||
|
||||
// Init
|
||||
class CInit
|
||||
{
|
||||
public:
|
||||
CInit()
|
||||
{
|
||||
// Init openssl library multithreading support
|
||||
ppmutexOpenSSL = (boost::interprocess::interprocess_mutex**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(boost::interprocess::interprocess_mutex*));
|
||||
for (int i = 0; i < CRYPTO_num_locks(); i++)
|
||||
ppmutexOpenSSL[i] = new boost::interprocess::interprocess_mutex();
|
||||
CRYPTO_set_locking_callback(locking_callback);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Seed random number generator with screen scrape and other hardware sources
|
||||
RAND_screen();
|
||||
#endif
|
||||
|
||||
// Seed random number generator with performance counter
|
||||
RandAddSeed();
|
||||
}
|
||||
~CInit()
|
||||
{
|
||||
// Shutdown openssl library multithreading support
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
for (int i = 0; i < CRYPTO_num_locks(); i++)
|
||||
delete ppmutexOpenSSL[i];
|
||||
OPENSSL_free(ppmutexOpenSSL);
|
||||
}
|
||||
}
|
||||
instance_of_cinit;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void RandAddSeed()
|
||||
{
|
||||
// Seed with CPU performance counter
|
||||
int64 nCounter = GetPerformanceCounter();
|
||||
RAND_add(&nCounter, sizeof(nCounter), 1.5);
|
||||
memset(&nCounter, 0, sizeof(nCounter));
|
||||
}
|
||||
|
||||
void RandAddSeedPerfmon()
|
||||
{
|
||||
RandAddSeed();
|
||||
|
||||
// This can take up to 2 seconds, so only do it every 10 minutes
|
||||
static int64 nLastPerfmon;
|
||||
if (GetTime() < nLastPerfmon + 10 * 60)
|
||||
return;
|
||||
nLastPerfmon = GetTime();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
|
||||
// Seed with the entire set of perfmon data
|
||||
unsigned char pdata[250000];
|
||||
memset(pdata, 0, sizeof(pdata));
|
||||
unsigned long nSize = sizeof(pdata);
|
||||
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
|
||||
RegCloseKey(HKEY_PERFORMANCE_DATA);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
RAND_add(pdata, nSize, nSize/100.0);
|
||||
memset(pdata, 0, nSize);
|
||||
printf("%s RandAddSeed() %d bytes\n", DateTimeStrFormat("%x %H:%M", GetTime()).c_str(), nSize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64 GetRand(uint64 nMax)
|
||||
{
|
||||
if (nMax == 0)
|
||||
return 0;
|
||||
|
||||
// The range of the random source must be a multiple of the modulus
|
||||
// to give every possible output value an equal possibility
|
||||
uint64 nRange = (UINT64_MAX / nMax) * nMax;
|
||||
uint64 nRand = 0;
|
||||
do
|
||||
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));
|
||||
while (nRand >= nRange);
|
||||
return (nRand % nMax);
|
||||
}
|
||||
|
||||
int GetRandInt(int nMax)
|
||||
{
|
||||
return GetRand(nMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline int OutputDebugStringF(const char* pszFormat, ...)
|
||||
{
|
||||
int ret = 0;
|
||||
if (fPrintToConsole)
|
||||
{
|
||||
// print to console
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, pszFormat);
|
||||
ret = vprintf(pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// print to debug.log
|
||||
static FILE* fileout = NULL;
|
||||
|
||||
if (!fileout)
|
||||
{
|
||||
char pszFile[MAX_PATH+100];
|
||||
GetDataDir(pszFile);
|
||||
strlcat(pszFile, "/debug.log", sizeof(pszFile));
|
||||
fileout = fopen(pszFile, "a");
|
||||
if (fileout) setbuf(fileout, NULL); // unbuffered
|
||||
}
|
||||
if (fileout)
|
||||
{
|
||||
static bool fStartedNewLine = true;
|
||||
|
||||
// Debug print useful for profiling
|
||||
if (fLogTimestamps && fStartedNewLine)
|
||||
fprintf(fileout, "%s ", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str());
|
||||
if (pszFormat[strlen(pszFormat) - 1] == '\n')
|
||||
fStartedNewLine = true;
|
||||
else
|
||||
fStartedNewLine = false;
|
||||
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, pszFormat);
|
||||
ret = vfprintf(fileout, pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
if (fPrintToDebugger)
|
||||
{
|
||||
static CCriticalSection cs_OutputDebugStringF;
|
||||
|
||||
// accumulate a line at a time
|
||||
CRITICAL_BLOCK(cs_OutputDebugStringF)
|
||||
{
|
||||
static char pszBuffer[50000];
|
||||
static char* pend;
|
||||
if (pend == NULL)
|
||||
pend = pszBuffer;
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, pszFormat);
|
||||
int limit = END(pszBuffer) - pend - 2;
|
||||
int ret = _vsnprintf(pend, limit, pszFormat, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret < 0 || ret >= limit)
|
||||
{
|
||||
pend = END(pszBuffer) - 2;
|
||||
*pend++ = '\n';
|
||||
}
|
||||
else
|
||||
pend += ret;
|
||||
*pend = '\0';
|
||||
char* p1 = pszBuffer;
|
||||
char* p2;
|
||||
while (p2 = strchr(p1, '\n'))
|
||||
{
|
||||
p2++;
|
||||
char c = *p2;
|
||||
*p2 = '\0';
|
||||
OutputDebugStringA(p1);
|
||||
*p2 = c;
|
||||
p1 = p2;
|
||||
}
|
||||
if (p1 != pszBuffer)
|
||||
memmove(pszBuffer, p1, pend - p1 + 1);
|
||||
pend -= (p1 - pszBuffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// Safer snprintf
|
||||
// - prints up to limit-1 characters
|
||||
// - output string is always null terminated even if limit reached
|
||||
// - return value is the number of characters actually printed
|
||||
int my_snprintf(char* buffer, size_t limit, const char* format, ...)
|
||||
{
|
||||
if (limit == 0)
|
||||
return 0;
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, format);
|
||||
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret < 0 || ret >= limit)
|
||||
{
|
||||
ret = limit - 1;
|
||||
buffer[limit-1] = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
string strprintf(const char* format, ...)
|
||||
{
|
||||
char buffer[50000];
|
||||
char* p = buffer;
|
||||
int limit = sizeof(buffer);
|
||||
int ret;
|
||||
loop
|
||||
{
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, format);
|
||||
ret = _vsnprintf(p, limit, format, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret >= 0 && ret < limit)
|
||||
break;
|
||||
if (p != buffer)
|
||||
delete p;
|
||||
limit *= 2;
|
||||
p = new char[limit];
|
||||
if (p == NULL)
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
string str(p, p+ret);
|
||||
if (p != buffer)
|
||||
delete p;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
bool error(const char* format, ...)
|
||||
{
|
||||
char buffer[50000];
|
||||
int limit = sizeof(buffer);
|
||||
va_list arg_ptr;
|
||||
va_start(arg_ptr, format);
|
||||
int ret = _vsnprintf(buffer, limit, format, arg_ptr);
|
||||
va_end(arg_ptr);
|
||||
if (ret < 0 || ret >= limit)
|
||||
{
|
||||
ret = limit - 1;
|
||||
buffer[limit-1] = 0;
|
||||
}
|
||||
printf("ERROR: %s\n", buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ParseString(const string& str, char c, vector<string>& v)
|
||||
{
|
||||
if (str.empty())
|
||||
return;
|
||||
string::size_type i1 = 0;
|
||||
string::size_type i2;
|
||||
loop
|
||||
{
|
||||
i2 = str.find(c, i1);
|
||||
if (i2 == str.npos)
|
||||
{
|
||||
v.push_back(str.substr(i1));
|
||||
return;
|
||||
}
|
||||
v.push_back(str.substr(i1, i2-i1));
|
||||
i1 = i2+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string FormatMoney(int64 n, bool fPlus)
|
||||
{
|
||||
// Note: not using straight sprintf here because we do NOT want
|
||||
// localized number formatting.
|
||||
int64 n_abs = (n > 0 ? n : -n);
|
||||
int64 quotient = n_abs/COIN;
|
||||
int64 remainder = n_abs%COIN;
|
||||
string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder);
|
||||
|
||||
// Right-trim excess 0's before the decimal point:
|
||||
int nTrim = 0;
|
||||
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
|
||||
++nTrim;
|
||||
if (nTrim)
|
||||
str.erase(str.size()-nTrim, nTrim);
|
||||
|
||||
// Insert thousands-separators:
|
||||
size_t point = str.find(".");
|
||||
for (int i = (str.size()-point)+3; i < str.size(); i += 4)
|
||||
if (isdigit(str[str.size() - i - 1]))
|
||||
str.insert(str.size() - i, 1, ',');
|
||||
if (n < 0)
|
||||
str.insert((unsigned int)0, 1, '-');
|
||||
else if (fPlus && n > 0)
|
||||
str.insert((unsigned int)0, 1, '+');
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
bool ParseMoney(const string& str, int64& nRet)
|
||||
{
|
||||
return ParseMoney(str.c_str(), nRet);
|
||||
}
|
||||
|
||||
bool ParseMoney(const char* pszIn, int64& nRet)
|
||||
{
|
||||
string strWhole;
|
||||
int64 nUnits = 0;
|
||||
const char* p = pszIn;
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
for (; *p; p++)
|
||||
{
|
||||
if (*p == ',' && p > pszIn && isdigit(p[-1]) && isdigit(p[1]) && isdigit(p[2]) && isdigit(p[3]) && !isdigit(p[4]))
|
||||
continue;
|
||||
if (*p == '.')
|
||||
{
|
||||
p++;
|
||||
int64 nMult = CENT*10;
|
||||
while (isdigit(*p) && (nMult > 0))
|
||||
{
|
||||
nUnits += nMult * (*p++ - '0');
|
||||
nMult /= 10;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isspace(*p))
|
||||
break;
|
||||
if (!isdigit(*p))
|
||||
return false;
|
||||
strWhole.insert(strWhole.end(), *p);
|
||||
}
|
||||
for (; *p; p++)
|
||||
if (!isspace(*p))
|
||||
return false;
|
||||
if (strWhole.size() > 14)
|
||||
return false;
|
||||
if (nUnits < 0 || nUnits > COIN)
|
||||
return false;
|
||||
int64 nWhole = atoi64(strWhole);
|
||||
int64 nValue = nWhole*COIN + nUnits;
|
||||
|
||||
nRet = nValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
vector<unsigned char> ParseHex(const char* psz)
|
||||
{
|
||||
static char phexdigit[256] =
|
||||
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,
|
||||
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
|
||||
|
||||
// convert hex dump to vector
|
||||
vector<unsigned char> vch;
|
||||
loop
|
||||
{
|
||||
while (isspace(*psz))
|
||||
psz++;
|
||||
char c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
unsigned char n = (c << 4);
|
||||
c = phexdigit[(unsigned char)*psz++];
|
||||
if (c == (char)-1)
|
||||
break;
|
||||
n |= c;
|
||||
vch.push_back(n);
|
||||
}
|
||||
return vch;
|
||||
}
|
||||
|
||||
vector<unsigned char> ParseHex(const string& str)
|
||||
{
|
||||
return ParseHex(str.c_str());
|
||||
}
|
||||
|
||||
|
||||
void ParseParameters(int argc, char* argv[])
|
||||
{
|
||||
mapArgs.clear();
|
||||
mapMultiArgs.clear();
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
char psz[10000];
|
||||
strlcpy(psz, argv[i], sizeof(psz));
|
||||
char* pszValue = (char*)"";
|
||||
if (strchr(psz, '='))
|
||||
{
|
||||
pszValue = strchr(psz, '=');
|
||||
*pszValue++ = '\0';
|
||||
}
|
||||
#ifdef __WXMSW__
|
||||
_strlwr(psz);
|
||||
if (psz[0] == '/')
|
||||
psz[0] = '-';
|
||||
#endif
|
||||
if (psz[0] != '-')
|
||||
break;
|
||||
mapArgs[psz] = pszValue;
|
||||
mapMultiArgs[psz].push_back(pszValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char* wxGetTranslation(const char* pszEnglish)
|
||||
{
|
||||
#ifdef GUI
|
||||
// Wrapper of wxGetTranslation returning the same const char* type as was passed in
|
||||
static CCriticalSection cs;
|
||||
CRITICAL_BLOCK(cs)
|
||||
{
|
||||
// Look in cache
|
||||
static map<string, char*> mapCache;
|
||||
map<string, char*>::iterator mi = mapCache.find(pszEnglish);
|
||||
if (mi != mapCache.end())
|
||||
return (*mi).second;
|
||||
|
||||
// wxWidgets translation
|
||||
wxString strTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8));
|
||||
|
||||
// We don't cache unknown strings because caller might be passing in a
|
||||
// dynamic string and we would keep allocating memory for each variation.
|
||||
if (strcmp(pszEnglish, strTranslated.utf8_str()) == 0)
|
||||
return pszEnglish;
|
||||
|
||||
// Add to cache, memory doesn't need to be freed. We only cache because
|
||||
// we must pass back a pointer to permanently allocated memory.
|
||||
char* pszCached = new char[strlen(strTranslated.utf8_str())+1];
|
||||
strcpy(pszCached, strTranslated.utf8_str());
|
||||
mapCache[pszEnglish] = pszCached;
|
||||
return pszCached;
|
||||
}
|
||||
return NULL;
|
||||
#else
|
||||
return pszEnglish;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool WildcardMatch(const char* psz, const char* mask)
|
||||
{
|
||||
loop
|
||||
{
|
||||
switch (*mask)
|
||||
{
|
||||
case '\0':
|
||||
return (*psz == '\0');
|
||||
case '*':
|
||||
return WildcardMatch(psz, mask+1) || (*psz && WildcardMatch(psz+1, mask));
|
||||
case '?':
|
||||
if (*psz == '\0')
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
if (*psz != *mask)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
psz++;
|
||||
mask++;
|
||||
}
|
||||
}
|
||||
|
||||
bool WildcardMatch(const string& str, const string& mask)
|
||||
{
|
||||
return WildcardMatch(str.c_str(), mask.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void FormatException(char* pszMessage, std::exception* pex, const char* pszThread)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
char pszModule[MAX_PATH];
|
||||
pszModule[0] = '\0';
|
||||
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
|
||||
#else
|
||||
const char* pszModule = "bitcoin";
|
||||
#endif
|
||||
if (pex)
|
||||
snprintf(pszMessage, 1000,
|
||||
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
|
||||
else
|
||||
snprintf(pszMessage, 1000,
|
||||
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
|
||||
}
|
||||
|
||||
void LogException(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n%s", pszMessage);
|
||||
}
|
||||
|
||||
void PrintException(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
strMiscWarning = pszMessage;
|
||||
#ifdef GUI
|
||||
if (wxTheApp && !fDaemon)
|
||||
MyMessageBox(pszMessage, "Bitcoin", wxOK | wxICON_ERROR);
|
||||
#endif
|
||||
throw;
|
||||
}
|
||||
|
||||
void ThreadOneMessageBox(string strMessage)
|
||||
{
|
||||
// Skip message boxes if one is already open
|
||||
static bool fMessageBoxOpen;
|
||||
if (fMessageBoxOpen)
|
||||
return;
|
||||
fMessageBoxOpen = true;
|
||||
ThreadSafeMessageBox(strMessage, "Bitcoin", wxOK | wxICON_EXCLAMATION);
|
||||
fMessageBoxOpen = false;
|
||||
}
|
||||
|
||||
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
|
||||
{
|
||||
char pszMessage[10000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
strMiscWarning = pszMessage;
|
||||
#ifdef GUI
|
||||
if (wxTheApp && !fDaemon)
|
||||
boost::thread(boost::bind(ThreadOneMessageBox, string(pszMessage)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
typedef WINSHELLAPI BOOL (WINAPI *PSHGETSPECIALFOLDERPATHA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
|
||||
string MyGetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
{
|
||||
char pszPath[MAX_PATH+100] = "";
|
||||
|
||||
// SHGetSpecialFolderPath isn't always available on old Windows versions
|
||||
HMODULE hShell32 = LoadLibraryA("shell32.dll");
|
||||
if (hShell32)
|
||||
{
|
||||
PSHGETSPECIALFOLDERPATHA pSHGetSpecialFolderPath =
|
||||
(PSHGETSPECIALFOLDERPATHA)GetProcAddress(hShell32, "SHGetSpecialFolderPathA");
|
||||
if (pSHGetSpecialFolderPath)
|
||||
(*pSHGetSpecialFolderPath)(NULL, pszPath, nFolder, fCreate);
|
||||
FreeModule(hShell32);
|
||||
}
|
||||
|
||||
// Backup option
|
||||
if (pszPath[0] == '\0')
|
||||
{
|
||||
if (nFolder == CSIDL_STARTUP)
|
||||
{
|
||||
strcpy(pszPath, getenv("USERPROFILE"));
|
||||
strcat(pszPath, "\\Start Menu\\Programs\\Startup");
|
||||
}
|
||||
else if (nFolder == CSIDL_APPDATA)
|
||||
{
|
||||
strcpy(pszPath, getenv("APPDATA"));
|
||||
}
|
||||
}
|
||||
|
||||
return pszPath;
|
||||
}
|
||||
#endif
|
||||
|
||||
string GetDefaultDataDir()
|
||||
{
|
||||
// Windows: C:\Documents and Settings\username\Application Data\Bitcoin
|
||||
// Mac: ~/Library/Application Support/Bitcoin
|
||||
// Unix: ~/.bitcoin
|
||||
#ifdef __WXMSW__
|
||||
// Windows
|
||||
return MyGetSpecialFolderPath(CSIDL_APPDATA, true) + "\\Bitcoin";
|
||||
#else
|
||||
char* pszHome = getenv("HOME");
|
||||
if (pszHome == NULL || strlen(pszHome) == 0)
|
||||
pszHome = (char*)"/";
|
||||
string strHome = pszHome;
|
||||
if (strHome[strHome.size()-1] != '/')
|
||||
strHome += '/';
|
||||
#ifdef __WXMAC_OSX__
|
||||
// Mac
|
||||
strHome += "Library/Application Support/";
|
||||
filesystem::create_directory(strHome.c_str());
|
||||
return strHome + "Bitcoin";
|
||||
#else
|
||||
// Unix
|
||||
return strHome + ".bitcoin";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetDataDir(char* pszDir)
|
||||
{
|
||||
// pszDir must be at least MAX_PATH length.
|
||||
int nVariation;
|
||||
if (pszSetDataDir[0] != 0)
|
||||
{
|
||||
strlcpy(pszDir, pszSetDataDir, MAX_PATH);
|
||||
nVariation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This can be called during exceptions by printf, so we cache the
|
||||
// value so we don't have to do memory allocations after that.
|
||||
static char pszCachedDir[MAX_PATH];
|
||||
if (pszCachedDir[0] == 0)
|
||||
strlcpy(pszCachedDir, GetDefaultDataDir().c_str(), sizeof(pszCachedDir));
|
||||
strlcpy(pszDir, pszCachedDir, MAX_PATH);
|
||||
nVariation = 1;
|
||||
}
|
||||
if (fTestNet)
|
||||
{
|
||||
char* p = pszDir + strlen(pszDir);
|
||||
if (p > pszDir && p[-1] != '/' && p[-1] != '\\')
|
||||
*p++ = '/';
|
||||
strcpy(p, "testnet");
|
||||
nVariation += 2;
|
||||
}
|
||||
static bool pfMkdir[4];
|
||||
if (!pfMkdir[nVariation])
|
||||
{
|
||||
pfMkdir[nVariation] = true;
|
||||
filesystem::create_directory(pszDir);
|
||||
}
|
||||
}
|
||||
|
||||
string GetDataDir()
|
||||
{
|
||||
char pszDir[MAX_PATH];
|
||||
GetDataDir(pszDir);
|
||||
return pszDir;
|
||||
}
|
||||
|
||||
string GetConfigFile()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
fs::path pathConfig(GetArg("-conf", "bitcoin.conf"));
|
||||
if (!pathConfig.is_complete())
|
||||
pathConfig = fs::path(GetDataDir()) / pathConfig;
|
||||
return pathConfig.string();
|
||||
}
|
||||
|
||||
void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||
map<string, vector<string> >& mapMultiSettingsRet)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
namespace pod = boost::program_options::detail;
|
||||
|
||||
fs::ifstream streamConfig(GetConfigFile());
|
||||
if (!streamConfig.good())
|
||||
return;
|
||||
|
||||
set<string> setOptions;
|
||||
setOptions.insert("*");
|
||||
|
||||
for (pod::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
|
||||
{
|
||||
// Don't overwrite existing settings so command line settings override bitcoin.conf
|
||||
string strKey = string("-") + it->string_key;
|
||||
if (mapSettingsRet.count(strKey) == 0)
|
||||
mapSettingsRet[strKey] = it->value[0];
|
||||
mapMultiSettingsRet[strKey].push_back(it->value[0]);
|
||||
}
|
||||
}
|
||||
|
||||
string GetPidFile()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
fs::path pathConfig(GetArg("-pid", "bitcoind.pid"));
|
||||
if (!pathConfig.is_complete())
|
||||
pathConfig = fs::path(GetDataDir()) / pathConfig;
|
||||
return pathConfig.string();
|
||||
}
|
||||
|
||||
void CreatePidFile(string pidFile, pid_t pid)
|
||||
{
|
||||
FILE* file;
|
||||
if (file = fopen(pidFile.c_str(), "w"))
|
||||
{
|
||||
fprintf(file, "%d\n", pid);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
int GetFilesize(FILE* file)
|
||||
{
|
||||
int nSavePos = ftell(file);
|
||||
int nFilesize = -1;
|
||||
if (fseek(file, 0, SEEK_END) == 0)
|
||||
nFilesize = ftell(file);
|
||||
fseek(file, nSavePos, SEEK_SET);
|
||||
return nFilesize;
|
||||
}
|
||||
|
||||
void ShrinkDebugFile()
|
||||
{
|
||||
// Scroll debug.log if it's getting too big
|
||||
string strFile = GetDataDir() + "/debug.log";
|
||||
FILE* file = fopen(strFile.c_str(), "r");
|
||||
if (file && GetFilesize(file) > 10 * 1000000)
|
||||
{
|
||||
// Restart the file with some of the end
|
||||
char pch[200000];
|
||||
fseek(file, -sizeof(pch), SEEK_END);
|
||||
int nBytes = fread(pch, 1, sizeof(pch), file);
|
||||
fclose(file);
|
||||
if (file = fopen(strFile.c_str(), "w"))
|
||||
{
|
||||
fwrite(pch, 1, nBytes, file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// "Never go to sea with two chronometers; take one or three."
|
||||
// Our three time sources are:
|
||||
// - System clock
|
||||
// - Median of other nodes's clocks
|
||||
// - The user (asking the user to fix the system clock if the first two disagree)
|
||||
//
|
||||
int64 GetTime()
|
||||
{
|
||||
return time(NULL);
|
||||
}
|
||||
|
||||
static int64 nTimeOffset = 0;
|
||||
|
||||
int64 GetAdjustedTime()
|
||||
{
|
||||
return GetTime() + nTimeOffset;
|
||||
}
|
||||
|
||||
void AddTimeData(unsigned int ip, int64 nTime)
|
||||
{
|
||||
int64 nOffsetSample = nTime - GetTime();
|
||||
|
||||
// Ignore duplicates
|
||||
static set<unsigned int> setKnown;
|
||||
if (!setKnown.insert(ip).second)
|
||||
return;
|
||||
|
||||
// Add data
|
||||
static vector<int64> vTimeOffsets;
|
||||
if (vTimeOffsets.empty())
|
||||
vTimeOffsets.push_back(0);
|
||||
vTimeOffsets.push_back(nOffsetSample);
|
||||
printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), vTimeOffsets.back(), vTimeOffsets.back()/60);
|
||||
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
|
||||
{
|
||||
sort(vTimeOffsets.begin(), vTimeOffsets.end());
|
||||
int64 nMedian = vTimeOffsets[vTimeOffsets.size()/2];
|
||||
// Only let other nodes change our time by so much
|
||||
if (abs64(nMedian) < 70 * 60)
|
||||
{
|
||||
nTimeOffset = nMedian;
|
||||
}
|
||||
else
|
||||
{
|
||||
nTimeOffset = 0;
|
||||
|
||||
static bool fDone;
|
||||
if (!fDone)
|
||||
{
|
||||
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
|
||||
bool fMatch = false;
|
||||
foreach(int64 nOffset, vTimeOffsets)
|
||||
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
|
||||
fMatch = true;
|
||||
|
||||
if (!fMatch)
|
||||
{
|
||||
fDone = true;
|
||||
string strMessage = _("Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.");
|
||||
strMiscWarning = strMessage;
|
||||
printf("*** %s\n", strMessage.c_str());
|
||||
boost::thread(boost::bind(ThreadSafeMessageBox, strMessage+" ", string("Bitcoin"), wxOK | wxICON_EXCLAMATION, (wxWindow*)NULL, -1, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach(int64 n, vTimeOffsets)
|
||||
printf("%+"PRI64d" ", n);
|
||||
printf("| nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
string FormatVersion(int nVersion)
|
||||
{
|
||||
if (nVersion%100 == 0)
|
||||
return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
|
||||
else
|
||||
return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
|
||||
}
|
||||
|
||||
string FormatFullVersion()
|
||||
{
|
||||
string s = FormatVersion(VERSION) + pszSubVer;
|
||||
if (VERSION_IS_BETA)
|
||||
s += _("-beta");
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
657
src/util.h
Normal file
657
src/util.h
Normal file
@@ -0,0 +1,657 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
#else
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||
#define for if (false) ; else for
|
||||
#endif
|
||||
#ifndef _MSC_VER
|
||||
#define __forceinline inline
|
||||
#endif
|
||||
|
||||
#define foreach BOOST_FOREACH
|
||||
#define loop for (;;)
|
||||
#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 printf OutputDebugStringF
|
||||
|
||||
#ifdef snprintf
|
||||
#undef snprintf
|
||||
#endif
|
||||
#define snprintf my_snprintf
|
||||
|
||||
#ifndef PRI64d
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MSVCRT__)
|
||||
#define PRI64d "I64d"
|
||||
#define PRI64u "I64u"
|
||||
#define PRI64x "I64x"
|
||||
#else
|
||||
#define PRI64d "lld"
|
||||
#define PRI64u "llu"
|
||||
#define PRI64x "llx"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
|
||||
#define PAIRTYPE(t1, t2) pair<t1, t2>
|
||||
|
||||
// Used to bypass the rule against non-const reference to temporary
|
||||
// where it makes sense with wrappers such as CFlatData or CTxDB
|
||||
template<typename T>
|
||||
inline T& REF(const T& val)
|
||||
{
|
||||
return (T&)val;
|
||||
}
|
||||
|
||||
// Align by increasing pointer, must have extra space at end of buffer
|
||||
template <size_t nBytes, typename T>
|
||||
T* alignup(T* p)
|
||||
{
|
||||
union
|
||||
{
|
||||
T* ptr;
|
||||
size_t n;
|
||||
} u;
|
||||
u.ptr = p;
|
||||
u.n = (u.n + (nBytes-1)) & ~(nBytes-1);
|
||||
return u.ptr;
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#define MSG_NOSIGNAL 0
|
||||
#define MSG_DONTWAIT 0
|
||||
#ifndef UINT64_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define INT64_MIN _I64_MIN
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 0400
|
||||
#define S_IWUSR 0200
|
||||
#endif
|
||||
#define unlink _unlink
|
||||
typedef int socklen_t;
|
||||
#else
|
||||
#define WSAGetLastError() errno
|
||||
#define WSAEWOULDBLOCK EWOULDBLOCK
|
||||
#define WSAEMSGSIZE EMSGSIZE
|
||||
#define WSAEINTR EINTR
|
||||
#define WSAEINPROGRESS EINPROGRESS
|
||||
#define WSAEADDRINUSE EADDRINUSE
|
||||
#define WSAENOTSOCK EBADF
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR -1
|
||||
typedef u_int SOCKET;
|
||||
#define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d)
|
||||
#define strlwr(psz) to_lower(psz)
|
||||
#define _strlwr(psz) to_lower(psz)
|
||||
#define MAX_PATH 1024
|
||||
#define Beep(n1,n2) (0)
|
||||
inline void Sleep(int64 n)
|
||||
{
|
||||
boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n));
|
||||
}
|
||||
#endif
|
||||
|
||||
inline int myclosesocket(SOCKET& hSocket)
|
||||
{
|
||||
if (hSocket == INVALID_SOCKET)
|
||||
return WSAENOTSOCK;
|
||||
#ifdef __WXMSW__
|
||||
int ret = closesocket(hSocket);
|
||||
#else
|
||||
int ret = close(hSocket);
|
||||
#endif
|
||||
hSocket = INVALID_SOCKET;
|
||||
return ret;
|
||||
}
|
||||
#define closesocket(s) myclosesocket(s)
|
||||
|
||||
#ifndef GUI
|
||||
inline const char* _(const char* psz)
|
||||
{
|
||||
return psz;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern map<string, string> mapArgs;
|
||||
extern map<string, vector<string> > mapMultiArgs;
|
||||
extern bool fDebug;
|
||||
extern bool fPrintToConsole;
|
||||
extern bool fPrintToDebugger;
|
||||
extern char pszSetDataDir[MAX_PATH];
|
||||
extern bool fRequestShutdown;
|
||||
extern bool fShutdown;
|
||||
extern bool fDaemon;
|
||||
extern bool fServer;
|
||||
extern bool fCommandLine;
|
||||
extern string strMiscWarning;
|
||||
extern bool fTestNet;
|
||||
extern bool fNoListen;
|
||||
extern bool fLogTimestamps;
|
||||
|
||||
void RandAddSeed();
|
||||
void RandAddSeedPerfmon();
|
||||
int OutputDebugStringF(const char* pszFormat, ...);
|
||||
int my_snprintf(char* buffer, size_t limit, const char* format, ...);
|
||||
string strprintf(const char* format, ...);
|
||||
bool error(const char* format, ...);
|
||||
void LogException(std::exception* pex, const char* pszThread);
|
||||
void PrintException(std::exception* pex, const char* pszThread);
|
||||
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
|
||||
void ParseString(const string& str, char c, vector<string>& v);
|
||||
string FormatMoney(int64 n, bool fPlus=false);
|
||||
bool ParseMoney(const string& str, int64& nRet);
|
||||
bool ParseMoney(const char* pszIn, int64& nRet);
|
||||
vector<unsigned char> ParseHex(const char* psz);
|
||||
vector<unsigned char> ParseHex(const string& str);
|
||||
void ParseParameters(int argc, char* argv[]);
|
||||
const char* wxGetTranslation(const char* psz);
|
||||
bool WildcardMatch(const char* psz, const char* mask);
|
||||
bool WildcardMatch(const string& str, const string& mask);
|
||||
int GetFilesize(FILE* file);
|
||||
void GetDataDir(char* pszDirRet);
|
||||
string GetConfigFile();
|
||||
string GetPidFile();
|
||||
void CreatePidFile(string pidFile, pid_t pid);
|
||||
void ReadConfigFile(map<string, string>& mapSettingsRet, map<string, vector<string> >& mapMultiSettingsRet);
|
||||
#ifdef __WXMSW__
|
||||
string MyGetSpecialFolderPath(int nFolder, bool fCreate);
|
||||
#endif
|
||||
string GetDefaultDataDir();
|
||||
string GetDataDir();
|
||||
void ShrinkDebugFile();
|
||||
int GetRandInt(int nMax);
|
||||
uint64 GetRand(uint64 nMax);
|
||||
int64 GetTime();
|
||||
int64 GetAdjustedTime();
|
||||
void AddTimeData(unsigned int ip, int64 nTime);
|
||||
string FormatFullVersion();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Wrapper to automatically initialize critical sections
|
||||
class CCriticalSection
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
protected:
|
||||
CRITICAL_SECTION cs;
|
||||
public:
|
||||
explicit CCriticalSection() { InitializeCriticalSection(&cs); }
|
||||
~CCriticalSection() { DeleteCriticalSection(&cs); }
|
||||
void Enter() { EnterCriticalSection(&cs); }
|
||||
void Leave() { LeaveCriticalSection(&cs); }
|
||||
bool TryEnter() { return TryEnterCriticalSection(&cs); }
|
||||
#else
|
||||
protected:
|
||||
boost::interprocess::interprocess_recursive_mutex mutex;
|
||||
public:
|
||||
explicit CCriticalSection() { }
|
||||
~CCriticalSection() { }
|
||||
void Enter() { mutex.lock(); }
|
||||
void Leave() { mutex.unlock(); }
|
||||
bool TryEnter() { return mutex.try_lock(); }
|
||||
#endif
|
||||
public:
|
||||
const char* pszFile;
|
||||
int nLine;
|
||||
};
|
||||
|
||||
// Automatically leave critical section when leaving block, needed for exception safety
|
||||
class CCriticalBlock
|
||||
{
|
||||
protected:
|
||||
CCriticalSection* pcs;
|
||||
public:
|
||||
CCriticalBlock(CCriticalSection& csIn) { pcs = &csIn; pcs->Enter(); }
|
||||
~CCriticalBlock() { pcs->Leave(); }
|
||||
};
|
||||
|
||||
// WARNING: This will catch continue and break!
|
||||
// break is caught with an assertion, but there's no way to detect continue.
|
||||
// I'd rather be careful than suffer the other more error prone syntax.
|
||||
// The compiler will optimise away all this loop junk.
|
||||
#define CRITICAL_BLOCK(cs) \
|
||||
for (bool fcriticalblockonce=true; fcriticalblockonce; assert(("break caught by CRITICAL_BLOCK!", !fcriticalblockonce)), fcriticalblockonce=false) \
|
||||
for (CCriticalBlock criticalblock(cs); fcriticalblockonce && (cs.pszFile=__FILE__, cs.nLine=__LINE__, true); fcriticalblockonce=false, cs.pszFile=NULL, cs.nLine=0)
|
||||
|
||||
class CTryCriticalBlock
|
||||
{
|
||||
protected:
|
||||
CCriticalSection* pcs;
|
||||
public:
|
||||
CTryCriticalBlock(CCriticalSection& csIn) { pcs = (csIn.TryEnter() ? &csIn : NULL); }
|
||||
~CTryCriticalBlock() { if (pcs) pcs->Leave(); }
|
||||
bool Entered() { return pcs != NULL; }
|
||||
};
|
||||
|
||||
#define TRY_CRITICAL_BLOCK(cs) \
|
||||
for (bool fcriticalblockonce=true; fcriticalblockonce; assert(("break caught by TRY_CRITICAL_BLOCK!", !fcriticalblockonce)), fcriticalblockonce=false) \
|
||||
for (CTryCriticalBlock criticalblock(cs); fcriticalblockonce && (fcriticalblockonce = criticalblock.Entered()) && (cs.pszFile=__FILE__, cs.nLine=__LINE__, true); fcriticalblockonce=false, cs.pszFile=NULL, cs.nLine=0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline string i64tostr(int64 n)
|
||||
{
|
||||
return strprintf("%"PRI64d, n);
|
||||
}
|
||||
|
||||
inline string itostr(int n)
|
||||
{
|
||||
return strprintf("%d", n);
|
||||
}
|
||||
|
||||
inline int64 atoi64(const char* psz)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _atoi64(psz);
|
||||
#else
|
||||
return strtoll(psz, NULL, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int64 atoi64(const string& str)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return _atoi64(str.c_str());
|
||||
#else
|
||||
return strtoll(str.c_str(), NULL, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int atoi(const string& str)
|
||||
{
|
||||
return atoi(str.c_str());
|
||||
}
|
||||
|
||||
inline int roundint(double d)
|
||||
{
|
||||
return (int)(d > 0 ? d + 0.5 : d - 0.5);
|
||||
}
|
||||
|
||||
inline int64 roundint64(double d)
|
||||
{
|
||||
return (int64)(d > 0 ? d + 0.5 : d - 0.5);
|
||||
}
|
||||
|
||||
inline int64 abs64(int64 n)
|
||||
{
|
||||
return (n >= 0 ? n : -n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
string HexStr(const T itbegin, const T itend, bool fSpaces=false)
|
||||
{
|
||||
if (itbegin == itend)
|
||||
return "";
|
||||
const unsigned char* pbegin = (const unsigned char*)&itbegin[0];
|
||||
const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]);
|
||||
string str;
|
||||
str.reserve((pend-pbegin) * (fSpaces ? 3 : 2));
|
||||
for (const unsigned char* p = pbegin; p != pend; p++)
|
||||
str += strprintf((fSpaces && p != pend-1 ? "%02x " : "%02x"), *p);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline string HexStr(const vector<unsigned char>& vch, bool fSpaces=false)
|
||||
{
|
||||
return HexStr(vch.begin(), vch.end(), fSpaces);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
string HexNumStr(const T itbegin, const T itend, bool f0x=true)
|
||||
{
|
||||
if (itbegin == itend)
|
||||
return "";
|
||||
const unsigned char* pbegin = (const unsigned char*)&itbegin[0];
|
||||
const unsigned char* pend = pbegin + (itend - itbegin) * sizeof(itbegin[0]);
|
||||
string str = (f0x ? "0x" : "");
|
||||
str.reserve(str.size() + (pend-pbegin) * 2);
|
||||
for (const unsigned char* p = pend-1; p >= pbegin; p--)
|
||||
str += strprintf("%02x", *p);
|
||||
return str;
|
||||
}
|
||||
|
||||
inline string HexNumStr(const vector<unsigned char>& vch, bool f0x=true)
|
||||
{
|
||||
return HexNumStr(vch.begin(), vch.end(), f0x);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void PrintHex(const T pbegin, const T pend, const char* pszFormat="%s", bool fSpaces=true)
|
||||
{
|
||||
printf(pszFormat, HexStr(pbegin, pend, fSpaces).c_str());
|
||||
}
|
||||
|
||||
inline void PrintHex(const vector<unsigned char>& vch, const char* pszFormat="%s", bool fSpaces=true)
|
||||
{
|
||||
printf(pszFormat, HexStr(vch, fSpaces).c_str());
|
||||
}
|
||||
|
||||
inline int64 GetPerformanceCounter()
|
||||
{
|
||||
int64 nCounter = 0;
|
||||
#ifdef __WXMSW__
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
|
||||
#else
|
||||
timeval t;
|
||||
gettimeofday(&t, NULL);
|
||||
nCounter = t.tv_sec * 1000000 + t.tv_usec;
|
||||
#endif
|
||||
return nCounter;
|
||||
}
|
||||
|
||||
inline int64 GetTimeMillis()
|
||||
{
|
||||
return (posix_time::ptime(posix_time::microsec_clock::universal_time()) -
|
||||
posix_time::ptime(gregorian::date(1970,1,1))).total_milliseconds();
|
||||
}
|
||||
|
||||
inline string DateTimeStrFormat(const char* pszFormat, int64 nTime)
|
||||
{
|
||||
time_t n = nTime;
|
||||
struct tm* ptmTime = gmtime(&n);
|
||||
char pszTime[200];
|
||||
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
|
||||
return pszTime;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void skipspaces(T& it)
|
||||
{
|
||||
while (isspace(*it))
|
||||
++it;
|
||||
}
|
||||
|
||||
inline bool IsSwitchChar(char c)
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
return c == '-' || c == '/';
|
||||
#else
|
||||
return c == '-';
|
||||
#endif
|
||||
}
|
||||
|
||||
inline string GetArg(const string& strArg, const string& strDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
return mapArgs[strArg];
|
||||
return strDefault;
|
||||
}
|
||||
|
||||
inline int64 GetArg(const string& strArg, int64 nDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
return atoi64(mapArgs[strArg]);
|
||||
return nDefault;
|
||||
}
|
||||
|
||||
inline bool GetBoolArg(const string& strArg)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
{
|
||||
if (mapArgs[strArg].empty())
|
||||
return true;
|
||||
return (atoi(mapArgs[strArg]) != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline void heapchk()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
/// for debugging
|
||||
//if (_heapchk() != _HEAPOK)
|
||||
// DebugBreak();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Randomize the stack to help protect against buffer overrun exploits
|
||||
#define IMPLEMENT_RANDOMIZE_STACK(ThreadFn) \
|
||||
{ \
|
||||
static char nLoops; \
|
||||
if (nLoops <= 0) \
|
||||
nLoops = GetRand(20) + 1; \
|
||||
if (nLoops-- > 1) \
|
||||
{ \
|
||||
ThreadFn; \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CATCH_PRINT_EXCEPTION(pszFn) \
|
||||
catch (std::exception& e) { \
|
||||
PrintException(&e, (pszFn)); \
|
||||
} catch (...) { \
|
||||
PrintException(NULL, (pszFn)); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
inline uint256 Hash(const T1 pbegin, const T1 pend)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Final((unsigned char*)&hash1, &ctx);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline uint256 Hash(const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end,
|
||||
const T3 p3begin, const T3 p3end)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, (p1begin == p1end ? pblank : (unsigned char*)&p1begin[0]), (p1end - p1begin) * sizeof(p1begin[0]));
|
||||
SHA256_Update(&ctx, (p2begin == p2end ? pblank : (unsigned char*)&p2begin[0]), (p2end - p2begin) * sizeof(p2begin[0]));
|
||||
SHA256_Update(&ctx, (p3begin == p3end ? pblank : (unsigned char*)&p3begin[0]), (p3end - p3begin) * sizeof(p3begin[0]));
|
||||
SHA256_Final((unsigned char*)&hash1, &ctx);
|
||||
uint256 hash2;
|
||||
SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=VERSION)
|
||||
{
|
||||
// Most of the time is spent allocating and deallocating CDataStream's
|
||||
// buffer. If this ever needs to be optimized further, make a CStaticStream
|
||||
// class with its buffer on the stack.
|
||||
CDataStream ss(nType, nVersion);
|
||||
ss.reserve(10000);
|
||||
ss << obj;
|
||||
return Hash(ss.begin(), ss.end());
|
||||
}
|
||||
|
||||
inline uint160 Hash160(const vector<unsigned char>& vch)
|
||||
{
|
||||
uint256 hash1;
|
||||
SHA256(&vch[0], vch.size(), (unsigned char*)&hash1);
|
||||
uint160 hash2;
|
||||
RIPEMD160((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Note: It turns out we might have been able to use boost::thread
|
||||
// by using TerminateThread(boost::thread.native_handle(), 0);
|
||||
#ifdef __WXMSW__
|
||||
typedef HANDLE pthread_t;
|
||||
|
||||
inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
|
||||
{
|
||||
DWORD nUnused = 0;
|
||||
HANDLE hthread =
|
||||
CreateThread(
|
||||
NULL, // default security
|
||||
0, // inherit stack size from parent
|
||||
(LPTHREAD_START_ROUTINE)pfn, // function pointer
|
||||
parg, // argument
|
||||
0, // creation option, start immediately
|
||||
&nUnused); // thread identifier
|
||||
if (hthread == NULL)
|
||||
{
|
||||
printf("Error: CreateThread() returned %d\n", GetLastError());
|
||||
return (pthread_t)0;
|
||||
}
|
||||
if (!fWantHandle)
|
||||
{
|
||||
CloseHandle(hthread);
|
||||
return (pthread_t)-1;
|
||||
}
|
||||
return hthread;
|
||||
}
|
||||
|
||||
inline void SetThreadPriority(int nPriority)
|
||||
{
|
||||
SetThreadPriority(GetCurrentThread(), nPriority);
|
||||
}
|
||||
#else
|
||||
inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false)
|
||||
{
|
||||
pthread_t hthread = 0;
|
||||
int ret = pthread_create(&hthread, NULL, (void*(*)(void*))pfn, parg);
|
||||
if (ret != 0)
|
||||
{
|
||||
printf("Error: pthread_create() returned %d\n", ret);
|
||||
return (pthread_t)0;
|
||||
}
|
||||
if (!fWantHandle)
|
||||
return (pthread_t)-1;
|
||||
return hthread;
|
||||
}
|
||||
|
||||
#define THREAD_PRIORITY_LOWEST PRIO_MAX
|
||||
#define THREAD_PRIORITY_BELOW_NORMAL 2
|
||||
#define THREAD_PRIORITY_NORMAL 0
|
||||
#define THREAD_PRIORITY_ABOVE_NORMAL 0
|
||||
|
||||
inline void SetThreadPriority(int nPriority)
|
||||
{
|
||||
// It's unclear if it's even possible to change thread priorities on Linux,
|
||||
// but we really and truly need it for the generation threads.
|
||||
#ifdef PRIO_THREAD
|
||||
setpriority(PRIO_THREAD, 0, nPriority);
|
||||
#else
|
||||
setpriority(PRIO_PROCESS, 0, nPriority);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool TerminateThread(pthread_t hthread, unsigned int nExitCode)
|
||||
{
|
||||
return (pthread_cancel(hthread) == 0);
|
||||
}
|
||||
|
||||
inline void ExitThread(unsigned int nExitCode)
|
||||
{
|
||||
pthread_exit((void*)nExitCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline bool AffinityBugWorkaround(void(*pfn)(void*))
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
// Sometimes after a few hours affinity gets stuck on one processor
|
||||
DWORD dwProcessAffinityMask = -1;
|
||||
DWORD dwSystemAffinityMask = -1;
|
||||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask);
|
||||
DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask);
|
||||
if (dwPrev2 != dwProcessAffinityMask)
|
||||
{
|
||||
printf("AffinityBugWorkaround() : SetThreadAffinityMask=%d, ProcessAffinityMask=%d, restarting thread\n", dwPrev2, dwProcessAffinityMask);
|
||||
if (!CreateThread(pfn, NULL))
|
||||
printf("Error: CreateThread() failed\n");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
665
src/xpm/about.xpm
Normal file
665
src/xpm/about.xpm
Normal file
@@ -0,0 +1,665 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
/* XPM */
|
||||
static const char * about_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"96 564 92 1",
|
||||
" c #001269",
|
||||
". c #000C72",
|
||||
"X c #00057F",
|
||||
"o c #001175",
|
||||
"O c #000B6A",
|
||||
"+ c #000E84",
|
||||
"@ c #000489",
|
||||
"# c #001583",
|
||||
"$ c #001B89",
|
||||
"% c #001B99",
|
||||
"& c #000B92",
|
||||
"* c #00208B",
|
||||
"= c #002B97",
|
||||
"- c #0004A6",
|
||||
"; c #001DA7",
|
||||
": c #0014BC",
|
||||
"> c #0019BB",
|
||||
", c #0017B4",
|
||||
"< c #0023A3",
|
||||
"1 c #002CAA",
|
||||
"2 c #0030A4",
|
||||
"3 c #003BA3",
|
||||
"4 c #0033AB",
|
||||
"5 c #003FA8",
|
||||
"6 c #0027B8",
|
||||
"7 c #0035BB",
|
||||
"8 c #003CBA",
|
||||
"9 c #004ABD",
|
||||
"0 c #001DC4",
|
||||
"q c #0017CC",
|
||||
"w c #000CD0",
|
||||
"e c #0026C7",
|
||||
"r c #0035C4",
|
||||
"t c #003DC5",
|
||||
"y c #0032CB",
|
||||
"u c #003BCC",
|
||||
"i c #002BD3",
|
||||
"p c #0021DC",
|
||||
"a c #0025D5",
|
||||
"s c #0034D5",
|
||||
"d c #003ADB",
|
||||
"f c #0016F6",
|
||||
"g c #0008F9",
|
||||
"h c #0027E3",
|
||||
"j c #003CE9",
|
||||
"k c #002BF5",
|
||||
"l c #0024F9",
|
||||
"z c #0033F4",
|
||||
"x c #0035F8",
|
||||
"c c #0048CA",
|
||||
"v c #0055C5",
|
||||
"b c #0059C3",
|
||||
"n c #0053CB",
|
||||
"m c #005ACC",
|
||||
"M c #004FD4",
|
||||
"N c #004CDC",
|
||||
"B c #0047D0",
|
||||
"V c #005BD6",
|
||||
"C c #0049E5",
|
||||
"Z c #0042EA",
|
||||
"A c #0052E4",
|
||||
"S c #005CE4",
|
||||
"D c #0054EC",
|
||||
"F c #005EEB",
|
||||
"G c #004AF5",
|
||||
"H c #0051F2",
|
||||
"J c #005CFA",
|
||||
"K c #0058F9",
|
||||
"L c #0066E4",
|
||||
"P c #006BE3",
|
||||
"I c #0064EC",
|
||||
"U c #006DEF",
|
||||
"Y c #0074EB",
|
||||
"T c #0078EC",
|
||||
"R c #0073E7",
|
||||
"E c #0065F4",
|
||||
"W c #006BF5",
|
||||
"Q c #006BFB",
|
||||
"! c #0066FD",
|
||||
"~ c #0073F5",
|
||||
"^ c #007CF3",
|
||||
"/ c #0075FB",
|
||||
"( c #007DFC",
|
||||
") c #0084FF",
|
||||
"_ c #008AFF",
|
||||
"` c #0092FF",
|
||||
"' c #339CFF",
|
||||
"] c #33A3FF",
|
||||
"[ c #33AAFF",
|
||||
"{ c #66B5FF",
|
||||
"} c #66BBFF",
|
||||
"| c #66C0FF",
|
||||
/* pixels */
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"kkkkkkkkkkkk<<<<<<<<<<<<DDDDDDDDDDDDvvvvvvvvvvvv////////////))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"XXXXXXXXXXXXrrrrrrrrrrrr777777777777MMMMMMMMMMMM(((((((((((())))))))))))[[[[[[[[[[[[}}}}}}}}}}}}",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"llllllllllll;;;;;;;;;;;;NNNNNNNNNNNNSSSSSSSSSSSS~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############666666666666uuuuuuuuuuuuJJJJJJJJJJJJ^^^^^^^^^^^^____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"............yyyyyyyyyyyy333333333333AAAAAAAAAAAAWWWWWWWWWWWW____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff============yyyyyyyyyyyyJJJJJJJJJJJJRRRRRRRRRRRR))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"gggggggggggg$$$$$$$$$$$$uuuuuuuuuuuuNNNNNNNNNNNN~~~~~~~~~~~~))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::hhhhhhhhhhhhddddddddddddAAAAAAAAAAAAUUUUUUUUUUUU))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"zzzzzzzzzzzzGGGGGGGGGGGGBBBBBBBBBBBBDDDDDDDDDDDDPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"ffffffffffffssssssssssssjjjjjjjjjjjjnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"wwwwwwwwwwww<<<<<<<<<<<<888888888888VVVVVVVVVVVV~~~~~~~~~~~~((((((((((((]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"hhhhhhhhhhhh>>>>>>>>>>>>rrrrrrrrrrrrVVVVVVVVVVVVLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::;;;;;;;;;;;;HHHHHHHHHHHHccccccccccccQQQQQQQQQQQQ))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqqkkkkkkkkkkkk333333333333AAAAAAAAAAAARRRRRRRRRRRR))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"############ppppppppppppssssssssssssIIIIIIIIIIII^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++rrrrrrrrrrrr777777777777MMMMMMMMMMMMIIIIIIIIIIII````````````''''''''''''{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"------------$$$$$$$$$$$$999999999999JJJJJJJJJJJJTTTTTTTTTTTT____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@666666666666ttttttttttttWWWWWWWWWWWWPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaazzzzzzzzzzzzBBBBBBBBBBBBbbbbbbbbbbbbPPPPPPPPPPPP____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"------------%%%%%%%%%%%%ttttttttttttNNNNNNNNNNNN^^^^^^^^^^^^))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
" 000000000000888888888888FFFFFFFFFFFF~~~~~~~~~~~~))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++222222222222xxxxxxxxxxxxNNNNNNNNNNNNEEEEEEEEEEEE))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"$$$$$$$$$$$$000000000000GGGGGGGGGGGGnnnnnnnnnnnnLLLLLLLLLLLL))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"ooooooooooooffffffffffffccccccccccccbbbbbbbbbbbbRRRRRRRRRRRR____________''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
"@@@@@@@@@@@@111111111111777777777777JJJJJJJJJJJJPPPPPPPPPPPP((((((((((((''''''''''''{{{{{{{{{{{{",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
" iiiiiiiiiiiiGGGGGGGGGGGGVVVVVVVVVVVV~~~~~~~~~~~~____________''''''''''''}}}}}}}}}}}}",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"------------222222222222KKKKKKKKKKKKIIIIIIIIIIIIQQQQQQQQQQQQ____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"&&&&&&&&&&&&222222222222333333333333WWWWWWWWWWWW~~~~~~~~~~~~____________''''''''''''{{{{{{{{{{{{",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"wwwwwwwwwwww============555555555555EEEEEEEEEEEEEEEEEEEEEEEE____________''''''''''''||||||||||||",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ffffffffffff>>>>>>>>>>>>rrrrrrrrrrrrnnnnnnnnnnnn~~~~~~~~~~~~____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"############$$$$$$$$$$$$CCCCCCCCCCCCEEEEEEEEEEEE(((((((((((())))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
",,,,,,,,,,,,666666666666ddddddddddddHHHHHHHHHHHHEEEEEEEEEEEE____________]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"xxxxxxxxxxxxjjjjjjjjjjjjccccccccccccSSSSSSSSSSSSPPPPPPPPPPPP))))))))))))]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
"000000000000%%%%%%%%%%%%ttttttttttttmmmmmmmmmmmm////////////````````````''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
">>>>>>>>>>>>uuuuuuuuuuuuZZZZZZZZZZZZmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"OOOOOOOOOOOO444444444444888888888888KKKKKKKKKKKKTTTTTTTTTTTT))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"++++++++++++666666666666CCCCCCCCCCCCQQQQQQQQQQQQYYYYYYYYYYYY____________''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"oooooooooooo,,,,,,,,,,,,DDDDDDDDDDDDmmmmmmmmmmmmLLLLLLLLLLLL))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"::::::::::::eeeeeeeeeeee444444444444mmmmmmmmmmmm^^^^^^^^^^^^____________''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"............666666666666ZZZZZZZZZZZZbbbbbbbbbbbbPPPPPPPPPPPP````````````''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"aaaaaaaaaaaaiiiiiiiiiiiizzzzzzzzzzzzJJJJJJJJJJJJPPPPPPPPPPPP))))))))))))''''''''''''{{{{{{{{{{{{",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"............eeeeeeeeeeee444444444444IIIIIIIIIIIIWWWWWWWWWWWW))))))))))))''''''''''''}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"llllllllllll444444444444HHHHHHHHHHHHvvvvvvvvvvvv((((((((((((____________]]]]]]]]]]]]}}}}}}}}}}}}",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"qqqqqqqqqqqq111111111111ssssssssssssGGGGGGGGGGGGQQQQQQQQQQQQ____________[[[[[[[[[[[[{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppkkkkkkkkkkkkttttttttttttSSSSSSSSSSSS!!!!!!!!!!!!))))))))))))]]]]]]]]]]]]{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"ppppppppppppzzzzzzzzzzzzddddddddddddFFFFFFFFFFFFLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{",
|
||||
"666666666666************777777777777MMMMMMMMMMMMLLLLLLLLLLLL````````````''''''''''''{{{{{{{{{{{{"
|
||||
};
|
||||
278
src/xpm/addressbook16.xpm
Normal file
278
src/xpm/addressbook16.xpm
Normal file
@@ -0,0 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * addressbook16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #E6EFF7",
|
||||
"+ c #E6E6F7",
|
||||
"@ c #CEE6F7",
|
||||
"# c #DEDEEF",
|
||||
"$ c #D6DEEF",
|
||||
"% c #D6DEE6",
|
||||
"& c #CEDEF7",
|
||||
"* c #CEDEEF",
|
||||
"= c #EFF708",
|
||||
"- c #C5DEF7",
|
||||
"; c #CED6EF",
|
||||
": c None",
|
||||
"> c #C5D6E6",
|
||||
", c #BDD6F7",
|
||||
"< c #BDD6EF",
|
||||
"1 c #D6CECE",
|
||||
"2 c #BDCEE6",
|
||||
"3 c #BDC5E6",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDD631",
|
||||
"6 c #ADBDDE",
|
||||
"7 c #B5B5BD",
|
||||
"8 c #A5B5D6",
|
||||
"9 c #00FFFF",
|
||||
"0 c #9CB5CE",
|
||||
"q c #9CADD6",
|
||||
"w c #94A5D6",
|
||||
"e c #8CA5D6",
|
||||
"r c #8CA5CE",
|
||||
"t c #8CA5C5",
|
||||
"y c #849CC5",
|
||||
"u c #7B9CD6",
|
||||
"i c #7B9CCE",
|
||||
"p c #31BDCE",
|
||||
"a c #6B9CD6",
|
||||
"s c #00F708",
|
||||
"d c #8494AD",
|
||||
"f c #7B94B5",
|
||||
"g c #6B94D6",
|
||||
"h c #6B9C84",
|
||||
"j c #7B8CAD",
|
||||
"k c #738CAD",
|
||||
"l c #638CC5",
|
||||
"z c #10CE42",
|
||||
"x c #638CBD",
|
||||
"c c #7B849C",
|
||||
"v c #73849C",
|
||||
"b c #6B84A5",
|
||||
"n c #7B7BA5",
|
||||
"m c #6B849C",
|
||||
"M c #7B8C42",
|
||||
"N c #5A84C5",
|
||||
"B c #29AD6B",
|
||||
"V c #F74A4A",
|
||||
"C c #6384A5",
|
||||
"Z c #5284C5",
|
||||
"A c #637BA5",
|
||||
"S c #637B9C",
|
||||
"D c #9C637B",
|
||||
"F c #6B7B5A",
|
||||
"G c #637394",
|
||||
"H c #52739C",
|
||||
"J c #5A7384",
|
||||
"K c #526B94",
|
||||
"L c #426B94",
|
||||
"P c #52638C",
|
||||
"I c #426B7B",
|
||||
"U c #5A5A8C",
|
||||
"Y c #524A7B",
|
||||
"T c #425273",
|
||||
"R c #21636B",
|
||||
"E c #106394",
|
||||
"W c #106B52",
|
||||
"Q c #3A4273",
|
||||
"! c #31426B",
|
||||
"~ c #523163",
|
||||
"^ c #29426B",
|
||||
"/ c #293A63",
|
||||
"( c #213A63",
|
||||
") c #193A63",
|
||||
"_ c #193163",
|
||||
"` c #19315A",
|
||||
"' c #212963",
|
||||
"] c #10315A",
|
||||
"[ c #082952",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
": : : : : : : : : : : : : : : : ",
|
||||
": : H H H A d : 7 G K H H : : : ",
|
||||
"n n c X 4 k j X b n n : ",
|
||||
"n 2 c $ 8 6 4 x < + 4 4 C V ~ : ",
|
||||
"n * c X o $ y N u 6 $ + b D Y : ",
|
||||
"n * c X > g , S z R : ",
|
||||
"n * c * r r y g , 6 r q S s W : ",
|
||||
"n * c X 4 N u + m B I : ",
|
||||
"n * c X ; a - S 5 F : ",
|
||||
"n * c * r r r g - S = M : ",
|
||||
"n * c X 4 N - m h J : ",
|
||||
"n * c X ; a - A 9 E : ",
|
||||
"n * ( ] ` ^ P l y T / / ( p L : ",
|
||||
"n O > 0 f ) ! t 8 % n : ",
|
||||
"U U U U U U U ' Q U U U U U U : ",
|
||||
": : : : : : : : : : : : : : : : "
|
||||
};
|
||||
282
src/xpm/addressbook20.xpm
Normal file
282
src/xpm/addressbook20.xpm
Normal file
@@ -0,0 +1,282 @@
|
||||
/* XPM */
|
||||
static const char * addressbook20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #FFFFFF",
|
||||
". c #F7FFFF",
|
||||
"X c #F7F7FF",
|
||||
"o c #EFF7FF",
|
||||
"O c #EFF7F7",
|
||||
"+ c #E6EFFF",
|
||||
"@ c #E6EFF7",
|
||||
"# c #DEEFFF",
|
||||
"$ c #DEE6F7",
|
||||
"% c #DEE6EF",
|
||||
"& c #D6E6F7",
|
||||
"* c #FFFF00",
|
||||
"= c #DEDEE6",
|
||||
"- c #D6DEE6",
|
||||
"; c #D6D6DE",
|
||||
": c #CED6E6",
|
||||
"> c None",
|
||||
", c #C5D6E6",
|
||||
"< c #C5CEE6",
|
||||
"1 c #B5CEEF",
|
||||
"2 c #C5C5C5",
|
||||
"3 c #C5DE31",
|
||||
"4 c #B5C5DE",
|
||||
"5 c #BDC5C5",
|
||||
"6 c #ADC5EF",
|
||||
"7 c #B5C5CE",
|
||||
"8 c #BDBDBD",
|
||||
"9 c #B5BDCE",
|
||||
"0 c #ADBDDE",
|
||||
"q c #ADBDD6",
|
||||
"w c #B5CE52",
|
||||
"e c #ADB5C5",
|
||||
"r c #00FFFF",
|
||||
"t c #A5B5C5",
|
||||
"y c #9CB5CE",
|
||||
"u c #94B5DE",
|
||||
"i c #9CADD6",
|
||||
"p c #A5ADB5",
|
||||
"a c #94ADDE",
|
||||
"s c #94ADD6",
|
||||
"d c #9CADBD",
|
||||
"f c #8CADDE",
|
||||
"g c #BD9CA5",
|
||||
"h c #9CA5BD",
|
||||
"j c #9CA5B5",
|
||||
"k c #29D6E6",
|
||||
"l c #8CA5CE",
|
||||
"z c #849CCE",
|
||||
"x c #6BA5C5",
|
||||
"c c #739CDE",
|
||||
"v c #00FF00",
|
||||
"b c #739CD6",
|
||||
"n c #7B94CE",
|
||||
"m c #8494AD",
|
||||
"M c #7394CE",
|
||||
"N c #7B94B5",
|
||||
"B c #4AB584",
|
||||
"V c #848CB5",
|
||||
"C c #6B94CE",
|
||||
"Z c #6394D6",
|
||||
"A c #6394CE",
|
||||
"S c #7B8CAD",
|
||||
"D c #6B8CC5",
|
||||
"F c #738CAD",
|
||||
"G c #5294B5",
|
||||
"H c #6B84C5",
|
||||
"J c #7384A5",
|
||||
"K c #73849C",
|
||||
"L c #738494",
|
||||
"P c #FF4A4A",
|
||||
"I c #FF4A42",
|
||||
"U c #737B8C",
|
||||
"Y c #637BAD",
|
||||
"T c #527BBD",
|
||||
"R c #637394",
|
||||
"E c #637352",
|
||||
"W c #5A6B8C",
|
||||
"Q c #526B9C",
|
||||
"! c #63638C",
|
||||
"~ c #5A734A",
|
||||
"^ c #4A6B9C",
|
||||
"/ c #526B63",
|
||||
"( c #0884A5",
|
||||
") c #526384",
|
||||
"_ c #52637B",
|
||||
"` c #4A6B5A",
|
||||
"' c #52636B",
|
||||
"] c #525A8C",
|
||||
"[ c #525A7B",
|
||||
"{ c #426363",
|
||||
"} c #4A5A7B",
|
||||
"| c #425A8C",
|
||||
" . c #196B94",
|
||||
".. c #3A5A8C",
|
||||
"X. c #3A5A84",
|
||||
"o. c #087B4A",
|
||||
"O. c #21636B",
|
||||
"+. c #634263",
|
||||
"@. c #3A527B",
|
||||
"#. c #424A84",
|
||||
"$. c #315284",
|
||||
"%. c #295284",
|
||||
"&. c #3A4A6B",
|
||||
"*. c #42427B",
|
||||
"=. c #424273",
|
||||
"-. c #294A84",
|
||||
";. c #3A3A73",
|
||||
":. c #194284",
|
||||
">. c #104A63",
|
||||
",. c #213A6B",
|
||||
"<. c #31316B",
|
||||
"1. c #21315A",
|
||||
"2. c #212163",
|
||||
"3. c #08295A",
|
||||
"4. c #082152",
|
||||
"5. c #101952",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > U $.| | ^ S 2 > p W | | @.L > > > > ",
|
||||
"8 5 R - < Y j S O - ) g e > > ",
|
||||
"! V K - % a Q # - +.P <.> > ",
|
||||
"! & K - 0 z n D C b f n n z q +.P <.> > ",
|
||||
"! & K - % M A 1 - %.G #.> > ",
|
||||
"! & K - % u b # - o.v >.> > ",
|
||||
"! & K - 0 z n H M b 6 z n z q o.v >.> > ",
|
||||
"! & K - X - M A a - O.B @.> > ",
|
||||
"! & K - X % u b # - ` 3 / > > ",
|
||||
"! & K - 0 l i 4 u b # - ~ * E > > ",
|
||||
"! & K - X o $ s T b # - { w ' > > ",
|
||||
"! & K - % f b # - .k -.> > ",
|
||||
"! & K m d t 7 , u b # ; 9 9 h ( r :.> > ",
|
||||
"! & h _ _ [ &.4.$.A ,.1.} _ _ F x ] > > ",
|
||||
"! @ , y N _ 3._ N y , @ ! > > ",
|
||||
"*.*.*.*.*.*.*.*.;.5.*.*.*.*.*.*.*.2.> > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > ",
|
||||
"> > > > > > > > > > > > > > > > > > > > "
|
||||
};
|
||||
219
src/xpm/bitcoin16.xpm
Normal file
219
src/xpm/bitcoin16.xpm
Normal file
@@ -0,0 +1,219 @@
|
||||
/* XPM */
|
||||
static const char * bitcoin16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 197 2",
|
||||
" c #755507",
|
||||
". c #775606",
|
||||
"X c #795707",
|
||||
"o c #7D5A07",
|
||||
"O c #765608",
|
||||
"+ c #74550A",
|
||||
"@ c #75550A",
|
||||
"# c #75560A",
|
||||
"$ c #785708",
|
||||
"% c #78580B",
|
||||
"& c #7D5C0B",
|
||||
"* c #78590E",
|
||||
"= c #7E5F14",
|
||||
"- c #8A6711",
|
||||
"; c #8D6B15",
|
||||
": c #8A691A",
|
||||
"> c #93711C",
|
||||
", c #9D7A23",
|
||||
"< c #9F7B22",
|
||||
"1 c #9C7B2A",
|
||||
"2 c #9E7C28",
|
||||
"3 c #A37F26",
|
||||
"4 c #B4831B",
|
||||
"5 c #A68126",
|
||||
"6 c #A5852E",
|
||||
"7 c #A9872E",
|
||||
"8 c #AC862D",
|
||||
"9 c #AC872F",
|
||||
"0 c #AF8B30",
|
||||
"q c #AC8932",
|
||||
"w c #AF8A34",
|
||||
"e c #B08E36",
|
||||
"r c #B98F33",
|
||||
"t c #B18E3A",
|
||||
"y c #B39036",
|
||||
"u c #B69237",
|
||||
"i c #B3913B",
|
||||
"p c #B6923C",
|
||||
"a c #BD9338",
|
||||
"s c #B9993F",
|
||||
"d c #BA993F",
|
||||
"f c #C2932D",
|
||||
"g c #C09437",
|
||||
"h c #C59832",
|
||||
"j c #C39836",
|
||||
"k c #C89835",
|
||||
"l c #C59C3D",
|
||||
"z c #CF9E3E",
|
||||
"x c #CFA23F",
|
||||
"c c #D0A13A",
|
||||
"v c #D3A23A",
|
||||
"b c #D4A338",
|
||||
"n c #D6A33F",
|
||||
"m c #B19345",
|
||||
"M c #BF9940",
|
||||
"N c #BF9D43",
|
||||
"B c #B3954B",
|
||||
"V c #BD9A48",
|
||||
"C c #BC9C4B",
|
||||
"Z c #BD9F51",
|
||||
"A c #CAA244",
|
||||
"S c #C2A14B",
|
||||
"D c #C4A44B",
|
||||
"F c #C1A24C",
|
||||
"G c #C7A64C",
|
||||
"H c #C5A64E",
|
||||
"J c #C9A94F",
|
||||
"K c #D1A343",
|
||||
"L c #D7A644",
|
||||
"P c #D5A547",
|
||||
"I c #D6A547",
|
||||
"U c #DCAD42",
|
||||
"Y c #DDAB45",
|
||||
"T c #C3A151",
|
||||
"R c #C9A551",
|
||||
"E c #CAAA50",
|
||||
"W c #CBAD53",
|
||||
"Q c #CDAC52",
|
||||
"! c #CEA855",
|
||||
"~ c #CEB15A",
|
||||
"^ c #DEB154",
|
||||
"/ c #D1B35A",
|
||||
"( c #D7B35A",
|
||||
") c #D8B45D",
|
||||
"_ c #E3B34A",
|
||||
"` c #E2B34E",
|
||||
"' c #E6B54F",
|
||||
"] c #E2B350",
|
||||
"[ c #E3B352",
|
||||
"{ c #E4B451",
|
||||
"} c #E2B355",
|
||||
"| c #E7B853",
|
||||
" . c #E9BC51",
|
||||
".. c #ECBC53",
|
||||
"X. c #E7BE5A",
|
||||
"o. c #E2BA5C",
|
||||
"O. c #E2BC5C",
|
||||
"+. c #E9BB59",
|
||||
"@. c #EBBE59",
|
||||
"#. c #EABD5B",
|
||||
"$. c #E8BF5C",
|
||||
"%. c #E9BE5E",
|
||||
"&. c #C8AC63",
|
||||
"*. c #D0B162",
|
||||
"=. c #D5B567",
|
||||
"-. c #DABC62",
|
||||
";. c #D2B66B",
|
||||
":. c #D0B56D",
|
||||
">. c #DCBC6E",
|
||||
",. c #D2B972",
|
||||
"<. c #D7BE78",
|
||||
"1. c #E9BE62",
|
||||
"2. c #EEC05A",
|
||||
"3. c #F0C25F",
|
||||
"4. c #DEC26B",
|
||||
"5. c #DDC27A",
|
||||
"6. c #E0C167",
|
||||
"7. c #E5C067",
|
||||
"8. c #EBC463",
|
||||
"9. c #EEC460",
|
||||
"0. c #ECC364",
|
||||
"q. c #E4C16B",
|
||||
"w. c #E7C46B",
|
||||
"e. c #E9C56C",
|
||||
"r. c #E0C172",
|
||||
"t. c #E5C575",
|
||||
"y. c #E4C870",
|
||||
"u. c #E6CA72",
|
||||
"i. c #E6CA74",
|
||||
"p. c #E8CB73",
|
||||
"a. c #E9CE76",
|
||||
"s. c #EBD07B",
|
||||
"d. c #EED179",
|
||||
"f. c #F5D478",
|
||||
"g. c #F5D57C",
|
||||
"h. c #F4D67C",
|
||||
"j. c #F4D77E",
|
||||
"k. c #DEC781",
|
||||
"l. c #E0C883",
|
||||
"z. c #E3CA89",
|
||||
"x. c #E4CB8B",
|
||||
"c. c #E3CD8A",
|
||||
"v. c #E5CE8B",
|
||||
"b. c #E3CC8E",
|
||||
"n. c #E8D18D",
|
||||
"m. c #F6D980",
|
||||
"M. c #F7DB83",
|
||||
"N. c #F3DA86",
|
||||
"B. c #F7DA84",
|
||||
"V. c #F6DB84",
|
||||
"C. c #F7DB84",
|
||||
"Z. c #F7DA86",
|
||||
"A. c #F6DC85",
|
||||
"S. c #F7DC85",
|
||||
"D. c #F8DB85",
|
||||
"F. c #FADD85",
|
||||
"G. c #FBDE86",
|
||||
"H. c #F5DE8B",
|
||||
"J. c #FADD88",
|
||||
"K. c #F9DF8B",
|
||||
"L. c #E4CF93",
|
||||
"P. c #E6CF92",
|
||||
"I. c #E6D094",
|
||||
"U. c #EAD597",
|
||||
"Y. c #EBD698",
|
||||
"T. c #EFDA99",
|
||||
"R. c #F0DC9C",
|
||||
"E. c #FCE089",
|
||||
"W. c #FCE28B",
|
||||
"Q. c #FDE28B",
|
||||
"!. c #FCE38C",
|
||||
"~. c #FCE28D",
|
||||
"^. c #FCE38D",
|
||||
"/. c #FDE38D",
|
||||
"(. c #FEE38D",
|
||||
"). c #FDE38E",
|
||||
"_. c #FEE48D",
|
||||
"`. c #FEE58F",
|
||||
"'. c #FCE490",
|
||||
"]. c #FDE490",
|
||||
"[. c #FFE590",
|
||||
"{. c #FFE690",
|
||||
"}. c #FFE691",
|
||||
"|. c #FEE791",
|
||||
" X c #FFE692",
|
||||
".X c #FFE792",
|
||||
"XX c #FEE693",
|
||||
"oX c #FFE693",
|
||||
"OX c #FFE793",
|
||||
"+X c #FEE897",
|
||||
"@X c #F6E2A2",
|
||||
"#X c #F7E3A2",
|
||||
"$X c #FAE6A8",
|
||||
"%X c #FBE7A9",
|
||||
"&X c #FCE9AB",
|
||||
"*X c #FDEAAC",
|
||||
"=X c None",
|
||||
/* pixels */
|
||||
"=X=X=X=X=X0 S G D i =X=X=X=X=X=X",
|
||||
"=X=X=X9 6.).).).).).d.e =X=X=X=X",
|
||||
"=X=Xu C.J.O.( h ( o.D.).J & =X=X",
|
||||
"=X0 S.j.f 4 b.e P.K @.j.'.d % =X",
|
||||
"=X4.).k a T Y.&.Y.R 2.2.F.S.- =X",
|
||||
"e '.e.z ! v.&X,.k.*X:. .%.`.d # ",
|
||||
"H +X^ I P =.*X9 j T.k.U ' F.-.% ",
|
||||
"W '.` { } >.*X<.n.*XC b Y g.u.X ",
|
||||
"W |.` { 3.t.&Xm C c.%Xa n m.u.. ",
|
||||
"N '.9...@.r.&Xi A 5.*XM L W.~ . ",
|
||||
"5 m.f._ *.#X&XR.#X%X:.v 0.'.7 # ",
|
||||
"=XQ `.@.l t P.B I.u v { G.a.o =X",
|
||||
"=X3 u.W.0.A z.V b.+.1.J.E., # =X",
|
||||
"=X=X3 u.oXF.e.7.q.C.+XH.6 # =X=X",
|
||||
"=X=X=X=XS s.'.'.'.C.~ ; * =X=X=X",
|
||||
"=X=X=X=X=X=X1 1 > : = =X=X=X=X=X"
|
||||
};
|
||||
160
src/xpm/bitcoin20.xpm
Normal file
160
src/xpm/bitcoin20.xpm
Normal file
@@ -0,0 +1,160 @@
|
||||
/* XPM */
|
||||
static const char * bitcoin20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 134 2",
|
||||
" c #735305",
|
||||
". c #785706",
|
||||
"X c #7E5C07",
|
||||
"o c #755509",
|
||||
"O c #76580D",
|
||||
"+ c #7F6015",
|
||||
"@ c #85620D",
|
||||
"# c #89650D",
|
||||
"$ c #836215",
|
||||
"% c #886510",
|
||||
"& c #8E6B11",
|
||||
"* c #81641F",
|
||||
"= c #906D19",
|
||||
"- c #977116",
|
||||
"; c #96741E",
|
||||
": c #9B761E",
|
||||
"> c #947424",
|
||||
", c #9B7722",
|
||||
"< c #9D7824",
|
||||
"1 c #A47F23",
|
||||
"2 c #A17D2A",
|
||||
"3 c #A58125",
|
||||
"4 c #AA8327",
|
||||
"5 c #A4832F",
|
||||
"6 c #AD862B",
|
||||
"7 c #B28B2E",
|
||||
"8 c #A58433",
|
||||
"9 c #A88637",
|
||||
"0 c #AD8932",
|
||||
"q c #A78639",
|
||||
"w c #A8893C",
|
||||
"e c #B28C34",
|
||||
"r c #B88E33",
|
||||
"t c #B28E3A",
|
||||
"y c #B79136",
|
||||
"u c #BB9235",
|
||||
"i c #BB9639",
|
||||
"p c #C19836",
|
||||
"a c #C29539",
|
||||
"s c #C59C3C",
|
||||
"d c #A88B41",
|
||||
"f c #AF9045",
|
||||
"g c #B49342",
|
||||
"h c #BE9641",
|
||||
"j c #BD9B44",
|
||||
"k c #B29448",
|
||||
"l c #B7994B",
|
||||
"z c #B8994C",
|
||||
"x c #C09946",
|
||||
"c c #CB9E46",
|
||||
"v c #C59D4C",
|
||||
"b c #CFA246",
|
||||
"n c #CBAB47",
|
||||
"m c #CEA74A",
|
||||
"M c #D4A749",
|
||||
"N c #D6A94D",
|
||||
"B c #C7A754",
|
||||
"V c #CEA453",
|
||||
"C c #C6AA56",
|
||||
"Z c #CDA955",
|
||||
"A c #CBAB5B",
|
||||
"S c #D2AB54",
|
||||
"D c #D2AE5E",
|
||||
"F c #D9AE5A",
|
||||
"G c #D7B356",
|
||||
"H c #DDB35F",
|
||||
"J c #DFB95A",
|
||||
"K c #E1B554",
|
||||
"L c #E4BA56",
|
||||
"P c #E6BC5A",
|
||||
"I c #E9BE5E",
|
||||
"U c #C7AC64",
|
||||
"Y c #CBAF64",
|
||||
"T c #CDB166",
|
||||
"R c #D4B364",
|
||||
"E c #DBB463",
|
||||
"W c #DFB867",
|
||||
"Q c #D5B76B",
|
||||
"! c #DFBA6F",
|
||||
"~ c #D5BB76",
|
||||
"^ c #D7BE79",
|
||||
"/ c #E3BC64",
|
||||
"( c #E8BF64",
|
||||
") c #E0BB68",
|
||||
"_ c #DECA7A",
|
||||
"` c #EBC265",
|
||||
"' c #EBC36B",
|
||||
"] c #EFC96B",
|
||||
"[ c #F1C564",
|
||||
"{ c #F3CB6A",
|
||||
"} c #F9CD6C",
|
||||
"| c #FAD16C",
|
||||
" . c #E5C770",
|
||||
".. c #EEC774",
|
||||
"X. c #E6CE7E",
|
||||
"o. c #EFCE7A",
|
||||
"O. c #F1CB73",
|
||||
"+. c #F4CE7A",
|
||||
"@. c #F3D273",
|
||||
"#. c #FCD574",
|
||||
"$. c #FEDA76",
|
||||
"%. c #F5D47D",
|
||||
"&. c #FAD47B",
|
||||
"*. c #F2D97D",
|
||||
"=. c #FCDA7A",
|
||||
"-. c #DDC784",
|
||||
";. c #E1CA86",
|
||||
":. c #E4CE8B",
|
||||
">. c #ECD985",
|
||||
",. c #E7D18E",
|
||||
"<. c #F4DC84",
|
||||
"1. c #FCDC81",
|
||||
"2. c #F4DB8B",
|
||||
"3. c #FBDF8B",
|
||||
"4. c #EBD592",
|
||||
"5. c #EFDA99",
|
||||
"6. c #F1DD9C",
|
||||
"7. c #F6E081",
|
||||
"8. c #FDE484",
|
||||
"9. c #FFEA87",
|
||||
"0. c #F9E488",
|
||||
"q. c #FEE88D",
|
||||
"w. c #F9E394",
|
||||
"e. c #FFEB93",
|
||||
"r. c #FEE698",
|
||||
"t. c #FEEA9B",
|
||||
"y. c #FFF49A",
|
||||
"u. c #F7E4A4",
|
||||
"i. c #F9E5A5",
|
||||
"p. c #FCE9AA",
|
||||
"a. c #F7F0AA",
|
||||
"s. c #FEF1AE",
|
||||
"d. c #FEF6B3",
|
||||
"f. c None",
|
||||
/* pixels */
|
||||
"f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.",
|
||||
"f.f.f.f.f.f.f.0 y i i 0 , f.f.f.f.f.f.f.",
|
||||
"f.f.f.f.3 p P | $.| } { I p ; f.f.f.f.f.",
|
||||
"f.f.f.4 L | $.{ L K L ` =.#.` 3 $ f.f.f.",
|
||||
"f.f.6 [ $.{ M a Q 0 Q S ' %.q.*.6 o f.f.",
|
||||
"f.3 ' $.P i u r ,.< :.S +.%.0.y.*.& f.f.",
|
||||
"f.C e.%.c x T Y 6.U 5.T R @.#.0.9.n . f.",
|
||||
"f.>.t.W F A ^ p.u.~ -.p.i.C { { =.@.# f.",
|
||||
"e e.3.E H / j p.6.0 V ~ p.Y ( ` #.$.3 o ",
|
||||
"j p.2.( ( ! Z p.6.l R 6.6.t I I { #.y o ",
|
||||
"j e.1.( ! +.H i.i.-.:.i.u.R N K ` #.u ",
|
||||
"i 9.&.( ..1.) p.6.8 j w p.p.h N ' #.7 ",
|
||||
"4 =.7.` ....Z p.6.g D T p.i.t M [ } - o ",
|
||||
"f.J =.{ ` E i.p.p.i.p.p.6.k u M } K @ o ",
|
||||
"f.7 @.@./ S z f 4.d ,.q 2 r a ( { 6 f.",
|
||||
"f.f.m @.O.( / V 4.q :.v V V O.&.G X O f.",
|
||||
"f.f.: G 1.0.+.W R D R ! 4.d.d._ # f.f.",
|
||||
"f.f.f.2 C a.i.r.w.w.i.s.d.p.Y @ f.f.f.",
|
||||
"f.f.f.f.f.5 Z .<.3.2.X.A > . f.f.f.f.",
|
||||
"f.f.f.f.f.f.f.> > = # $ + f.f.f.f.f.f.f."
|
||||
};
|
||||
232
src/xpm/bitcoin32.xpm
Normal file
232
src/xpm/bitcoin32.xpm
Normal file
@@ -0,0 +1,232 @@
|
||||
/* XPM */
|
||||
static const char * bitcoin32_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 194 2",
|
||||
" c #745305",
|
||||
". c #785704",
|
||||
"X c #7C5903",
|
||||
"o c #75560B",
|
||||
"O c #77590F",
|
||||
"+ c #7C5C0B",
|
||||
"@ c #795B12",
|
||||
"# c #7F631D",
|
||||
"$ c #825E07",
|
||||
"% c #825F0B",
|
||||
"& c #85610A",
|
||||
"* c #8C660C",
|
||||
"= c #8E680E",
|
||||
"- c #916B0F",
|
||||
"; c #856515",
|
||||
": c #8B6714",
|
||||
"> c #8F6A16",
|
||||
", c #816218",
|
||||
"< c #88691C",
|
||||
"1 c #926D12",
|
||||
"2 c #936F1C",
|
||||
"3 c #997417",
|
||||
"4 c #94721E",
|
||||
"5 c #9B761C",
|
||||
"6 c #9F781C",
|
||||
"7 c #A17B1E",
|
||||
"8 c #826622",
|
||||
"9 c #916E20",
|
||||
"0 c #967425",
|
||||
"q c #9D7420",
|
||||
"w c #9C7923",
|
||||
"e c #997728",
|
||||
"r c #99792C",
|
||||
"t c #A37D23",
|
||||
"y c #A37F2C",
|
||||
"u c #A68125",
|
||||
"i c #AB8225",
|
||||
"p c #A5832B",
|
||||
"a c #AA852C",
|
||||
"s c #B28A2C",
|
||||
"d c #A58233",
|
||||
"f c #AC8734",
|
||||
"g c #AE8C33",
|
||||
"h c #AC8C3C",
|
||||
"j c #B28C33",
|
||||
"k c #B98E34",
|
||||
"l c #B28D3D",
|
||||
"z c #B59136",
|
||||
"x c #BC9335",
|
||||
"c c #B3913E",
|
||||
"v c #BC933A",
|
||||
"b c #BF9A3D",
|
||||
"n c #C19235",
|
||||
"m c #C2953C",
|
||||
"M c #C39B3C",
|
||||
"N c #CA9C3D",
|
||||
"B c #B59343",
|
||||
"V c #BE9642",
|
||||
"C c #B69A44",
|
||||
"Z c #BD9A45",
|
||||
"A c #B49649",
|
||||
"S c #BB9A49",
|
||||
"D c #BB9F52",
|
||||
"F c #BFA256",
|
||||
"G c #C49C43",
|
||||
"H c #CA9D41",
|
||||
"J c #C59D4A",
|
||||
"K c #C99E4D",
|
||||
"L c #C3A144",
|
||||
"P c #CDA244",
|
||||
"I c #CFAA47",
|
||||
"U c #C3A14D",
|
||||
"Y c #CDA24A",
|
||||
"T c #CCAB49",
|
||||
"R c #D2A644",
|
||||
"E c #D2A54B",
|
||||
"W c #D6AA4C",
|
||||
"Q c #DAAE4E",
|
||||
"! c #DAB04F",
|
||||
"~ c #C7A656",
|
||||
"^ c #CDA452",
|
||||
"/ c #CFAC52",
|
||||
"( c #C0A65E",
|
||||
") c #CEA75A",
|
||||
"_ c #CCAC59",
|
||||
"` c #D2AB53",
|
||||
"' c #DCAF52",
|
||||
"] c #D6AD5A",
|
||||
"[ c #D9AE5B",
|
||||
"{ c #DCB556",
|
||||
"} c #DFB855",
|
||||
"| c #D6B25F",
|
||||
" . c #DCB35C",
|
||||
".. c #DEBE5E",
|
||||
"X. c #E2B656",
|
||||
"o. c #E1B55A",
|
||||
"O. c #E6BC5D",
|
||||
"+. c #E9BD5E",
|
||||
"@. c #C3AA63",
|
||||
"#. c #CCAD62",
|
||||
"$. c #D4AF62",
|
||||
"%. c #CDB565",
|
||||
"&. c #CEB46D",
|
||||
"*. c #D7B164",
|
||||
"=. c #DBB362",
|
||||
"-. c #D6BD64",
|
||||
";. c #DDBA64",
|
||||
":. c #D3B66C",
|
||||
">. c #DFB86B",
|
||||
",. c #CEB772",
|
||||
"<. c #D0B771",
|
||||
"1. c #D4BA73",
|
||||
"2. c #D9BE77",
|
||||
"3. c #D6BE79",
|
||||
"4. c #D8BF7A",
|
||||
"5. c #E4BB62",
|
||||
"6. c #E9BF64",
|
||||
"7. c #E4BC69",
|
||||
"8. c #E9BF69",
|
||||
"9. c #E0BB71",
|
||||
"0. c #E9C05E",
|
||||
"q. c #D2C279",
|
||||
"w. c #DBC27C",
|
||||
"e. c #E2C667",
|
||||
"r. c #EDC364",
|
||||
"t. c #E3C16E",
|
||||
"y. c #ECC46C",
|
||||
"u. c #EDCC6C",
|
||||
"i. c #F1C764",
|
||||
"p. c #F5CA66",
|
||||
"a. c #F9CD67",
|
||||
"s. c #F5CC6A",
|
||||
"d. c #F9CD6B",
|
||||
"f. c #FBD36F",
|
||||
"g. c #EDC572",
|
||||
"h. c #E5CF77",
|
||||
"j. c #ECCA74",
|
||||
"k. c #E0C67E",
|
||||
"l. c #EFCE78",
|
||||
"z. c #F6CE72",
|
||||
"x. c #FBCF71",
|
||||
"c. c #F4CE79",
|
||||
"v. c #F4D273",
|
||||
"b. c #FCD473",
|
||||
"n. c #F4DC75",
|
||||
"m. c #FEDA74",
|
||||
"M. c #F6D77C",
|
||||
"N. c #FBD47A",
|
||||
"B. c #F1DA7B",
|
||||
"V. c #FDDA7C",
|
||||
"C. c #FEE27D",
|
||||
"Z. c #DDC683",
|
||||
"A. c #DFC884",
|
||||
"S. c #E4CA84",
|
||||
"D. c #E3CC89",
|
||||
"F. c #E7D183",
|
||||
"G. c #EFD280",
|
||||
"H. c #EFDC82",
|
||||
"J. c #ECD48D",
|
||||
"K. c #EFDA8C",
|
||||
"L. c #F9D783",
|
||||
"P. c #F2DF83",
|
||||
"I. c #FCDB83",
|
||||
"U. c #F5DC8F",
|
||||
"Y. c #FADD8B",
|
||||
"T. c #EBD593",
|
||||
"R. c #EFDA99",
|
||||
"E. c #F3DD93",
|
||||
"W. c #F3DF9F",
|
||||
"Q. c #FFE385",
|
||||
"!. c #FEE986",
|
||||
"~. c #FDE48C",
|
||||
"^. c #FEEC8E",
|
||||
"/. c #ECE199",
|
||||
"(. c #F6E591",
|
||||
"). c #FEE494",
|
||||
"_. c #FEEB93",
|
||||
"`. c #FEE69A",
|
||||
"'. c #FFEB9B",
|
||||
"]. c #FFF197",
|
||||
"[. c #FFF39B",
|
||||
"{. c #FEF99B",
|
||||
"}. c #F6E2A2",
|
||||
"|. c #F9E5A5",
|
||||
" X c #F7E9A5",
|
||||
".X c #FEECA4",
|
||||
"XX c #FBE7A8",
|
||||
"oX c #FDEAAB",
|
||||
"OX c #F7F2AA",
|
||||
"+X c #FEF2AC",
|
||||
"@X c #FDF4B4",
|
||||
"#X c #FFFABA",
|
||||
"$X c #FFFEC2",
|
||||
"%X c None",
|
||||
/* pixels */
|
||||
"%X%X%X%X%X%X%X%X%X%X%X%Xp t 6 5 w t w %X%X%X%X%X%X%X%X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%X%X%X%Xu u x I X.0.s.u.0.W x 7 4 %X%X%X%X%X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%X%Xy i I i.a.f.m.m.b.f.s.a.s.i.W 7 > %X%X%X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%Xt M 0.a.m.m.m.m.f.d.p.p.p.f.d.f.i.b 1 < %X%X%X%X%X%X",
|
||||
"%X%X%X%X%X7 ! d.f.f.m.f.+.W P R I Q 5.v.V.V.z.f.{ 5 + %X%X%X%X%X",
|
||||
"%X%X%X%Xu X.f.m.m.f.' H s ~ V y _ Z J o.g.L.L.Q.!.e.5 X %X%X%X%X",
|
||||
"%X%X%Xu X.b.C.m.+.N m n t }.3.> }.w.V 5.y.y.Y.[.^.^.-.1 + %X%X%X",
|
||||
"%X%Xt P m.N.m.X.v v v k 6 }.1.: /.4.c 7.N.N.v.!.{.{.^.L & %X%X%X",
|
||||
"%X%Xg Y.Y.V.+.m k a t t : }.1.% }.1.r | l.B.M.b.!.{.^.n.7 X %X%X",
|
||||
"%Xp -._.'.Y.' Y n D.}.}.|.oXXX|.oX XT.w.F _ j.v.v._.^.C.T & @ %X",
|
||||
"%Xa (.'.'.9.[ [ K S.}.oXoXoXoXXXoXoXoXoX XD / s.d.v.!.C.v.3 o %X",
|
||||
"%XU '.'.Y.[ [ [ [ J f <.oXoX( 2 f S J.oXoXT.j r.s.i.C.C.C.z X %X",
|
||||
"p e.'.'.F. .=.=.=.=.) 1.oXoX@.f . .F oXoX}.a +.i.i.b.C.m.I X O ",
|
||||
"u w.'.[.j.5.8.7.7.7.] 2.oXoX@.y W c &.oXoXZ.k r.s.i.s.V.m.} = o ",
|
||||
"u H.[.{.y.8.y.g.8.g.7.2.oXoXA.@.&.D.oXoXT.e G +.O.O.5.V.m.0.- o ",
|
||||
"u !.].[.r.8.y.g.g.g.7.4.oXoXoXoXoXoXoXoXoX<.y W X.o.o.m.m.0.- o ",
|
||||
"u B._._.5.5.8.y.g.c.g.w.oXoX,.h A F <..XoXoX1.k ' ' ' V.N.r.- ",
|
||||
"u u.Q.~.r.6.z.N.V.I.v.k.oXoX@.B | _ c 1.oXoX}.a ' ' O.I.b.O.= o ",
|
||||
"u ..Q.Q.v.i.s.c.N.L.l.Z.oXoX@.B t.=.S &.oXoXXXy Y R +.N.b.Q % o ",
|
||||
"t T C.I.I.6.u.z.z.5.S 1.oXoX@.e B h D |.oXoXS.f Y Y 6.d.d.n X O ",
|
||||
"%Xs m.V.Q.r.r.z.5.<.}.oXoXoXXXW.}.oXoXoXoXW.h G H R a.p.s.7 %X",
|
||||
"%X7 O.V.V.v.+.r.` 4.oXoXoXoXoXoXoXoXXXR.<.h v N N o.a.p.Q = %X",
|
||||
"%Xw x v.v.v.r.+. .Z l d e }.Z.r }.3.d l V G n n R a.s.a.s X O %X",
|
||||
"%X%X6 { v.l.v.+.O.5.=.^ d }.4.9 }.1.f J G m m G d.d.x.Q = %X%X",
|
||||
"%X%X%Xs u.v.v.v.r.6.o. .l }.4.9 W.4.l ^ ^ J ) c.N.N.y.7 X O %X%X",
|
||||
"%X%X%X5 z v.v.M.I.g.;. .J 1.#.B 1.#.) 7.$.S..X'.W.Y.j $ %X%X%X",
|
||||
"%X%X%X%X5 b N.Y.~.).Y.j.5.$.=.=.$.*.2.J.@X$X#X#XoXC $ %X%X%X%X",
|
||||
"%X%X%X%X%X3 z U.@X+X`.`.`.(.E.E.E.|.@X@X#X#X#X/.j % %X%X%X%X%X",
|
||||
"%X%X%X%X%X%Xw a q.OX|.).`._.'.'.XX.X.X+X+X X%.w X o %X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%X%X%Xw a _ j.~.~.).).`.`.`.F._ t & . # %X%X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%X%X%X%X%X4 3 t z L U Z z t 1 $ . 8 %X%X%X%X%X%X%X%X%X",
|
||||
"%X%X%X%X%X%X%X%X%X%X%X%X%X< ; & + + , 8 %X%X%X%X%X%X%X%X%X%X%X%X"
|
||||
};
|
||||
277
src/xpm/bitcoin48.xpm
Normal file
277
src/xpm/bitcoin48.xpm
Normal file
@@ -0,0 +1,277 @@
|
||||
/* XPM */
|
||||
static const char * bitcoin48_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"48 48 223 2",
|
||||
" c #765404",
|
||||
". c #795704",
|
||||
"X c #7C5904",
|
||||
"o c #7C5A0A",
|
||||
"O c #825E05",
|
||||
"+ c #815F0E",
|
||||
"@ c #815F11",
|
||||
"# c #866107",
|
||||
"$ c #866208",
|
||||
"% c #8A650A",
|
||||
"& c #8E680D",
|
||||
"* c #916B0E",
|
||||
"= c #866414",
|
||||
"- c #8C6715",
|
||||
"; c #8F6A10",
|
||||
": c #8A691B",
|
||||
"> c #956E12",
|
||||
", c #906D1D",
|
||||
"< c #967013",
|
||||
"1 c #997215",
|
||||
"2 c #94711F",
|
||||
"3 c #9C751A",
|
||||
"4 c #9E781C",
|
||||
"5 c #A27B1D",
|
||||
"6 c #947324",
|
||||
"7 c #997625",
|
||||
"8 c #9D7926",
|
||||
"9 c #97792B",
|
||||
"0 c #9D7B28",
|
||||
"q c #9C7F34",
|
||||
"w c #A47E22",
|
||||
"e c #A87F21",
|
||||
"r c #A37E2A",
|
||||
"t c #A8801F",
|
||||
"y c #A58025",
|
||||
"u c #AB8425",
|
||||
"i c #A5812C",
|
||||
"p c #AB842A",
|
||||
"a c #AB892D",
|
||||
"s c #B0862C",
|
||||
"d c #B48C2D",
|
||||
"f c #B88F2F",
|
||||
"g c #B9912E",
|
||||
"h c #A68432",
|
||||
"j c #AB8531",
|
||||
"k c #AD8A33",
|
||||
"l c #A68638",
|
||||
"z c #AD8B3B",
|
||||
"x c #B38C32",
|
||||
"c c #BA8E35",
|
||||
"v c #B28D3B",
|
||||
"b c #B59234",
|
||||
"n c #BD9235",
|
||||
"m c #B5903E",
|
||||
"M c #BC943B",
|
||||
"N c #BA9A3B",
|
||||
"B c #C29536",
|
||||
"V c #C59937",
|
||||
"C c #C2953B",
|
||||
"Z c #C49C3C",
|
||||
"A c #CA9E3D",
|
||||
"S c #AC8E43",
|
||||
"D c #AD9045",
|
||||
"F c #AE9248",
|
||||
"G c #B49444",
|
||||
"H c #B99542",
|
||||
"J c #B49842",
|
||||
"K c #BD9C44",
|
||||
"L c #B3954A",
|
||||
"P c #B7994D",
|
||||
"I c #BD9A4A",
|
||||
"U c #B69A52",
|
||||
"Y c #BB9E54",
|
||||
"T c #BEA04A",
|
||||
"R c #BFA354",
|
||||
"E c #BEA35A",
|
||||
"W c #C19742",
|
||||
"Q c #C49B43",
|
||||
"! c #CA9D41",
|
||||
"~ c #C39C4B",
|
||||
"^ c #C99E4A",
|
||||
"/ c #C7A444",
|
||||
"( c #CDA244",
|
||||
") c #CAA945",
|
||||
"_ c #C5A44C",
|
||||
"` c #CCA44B",
|
||||
"' c #C6A94C",
|
||||
"] c #CFAC4D",
|
||||
"[ c #D2A647",
|
||||
"{ c #D2A54B",
|
||||
"} c #D4AA4C",
|
||||
"| c #D9AC4D",
|
||||
" . c #D4B04E",
|
||||
".. c #DCB14D",
|
||||
"X. c #C4A151",
|
||||
"o. c #CAA454",
|
||||
"O. c #C6AB56",
|
||||
"+. c #CCA955",
|
||||
"@. c #C1A45A",
|
||||
"#. c #C6AA5A",
|
||||
"$. c #CDAB5D",
|
||||
"%. c #D1A652",
|
||||
"&. c #D4AB53",
|
||||
"*. c #DDAF52",
|
||||
"=. c #D3AC5B",
|
||||
"-. c #D9AF5C",
|
||||
";. c #D5B154",
|
||||
":. c #DDB253",
|
||||
">. c #D5B25B",
|
||||
",. c #DCB45D",
|
||||
"<. c #DDBB5E",
|
||||
"1. c #E1B354",
|
||||
"2. c #E4B955",
|
||||
"3. c #E3B65B",
|
||||
"4. c #E5BA5C",
|
||||
"5. c #EABE5E",
|
||||
"6. c #C6AB63",
|
||||
"7. c #CCAD63",
|
||||
"8. c #C6AE68",
|
||||
"9. c #C9AF69",
|
||||
"0. c #D4AC60",
|
||||
"q. c #CDB067",
|
||||
"w. c #CDB36C",
|
||||
"e. c #D6B162",
|
||||
"r. c #DDB463",
|
||||
"t. c #D7B964",
|
||||
"y. c #DBB965",
|
||||
"u. c #D1B66F",
|
||||
"i. c #DDB66A",
|
||||
"p. c #D0BC6C",
|
||||
"a. c #DFBE6B",
|
||||
"s. c #CEB772",
|
||||
"d. c #D1B771",
|
||||
"f. c #D4BC74",
|
||||
"g. c #DBBD75",
|
||||
"h. c #DABF78",
|
||||
"j. c #E2B764",
|
||||
"k. c #E4BA64",
|
||||
"l. c #E9BD62",
|
||||
"z. c #E2BB6A",
|
||||
"x. c #E8BF69",
|
||||
"c. c #EBC15F",
|
||||
"v. c #F1C25E",
|
||||
"b. c #DFC266",
|
||||
"n. c #DBC26C",
|
||||
"m. c #DCC676",
|
||||
"M. c #DEC973",
|
||||
"N. c #D7C07A",
|
||||
"B. c #D9C27E",
|
||||
"V. c #E4C162",
|
||||
"C. c #EDC363",
|
||||
"Z. c #E3C36F",
|
||||
"A. c #EBC26C",
|
||||
"S. c #E5CA6B",
|
||||
"D. c #EECA6D",
|
||||
"F. c #F1C565",
|
||||
"G. c #F5CB66",
|
||||
"H. c #F9CA66",
|
||||
"J. c #F2C76A",
|
||||
"K. c #F5CC6A",
|
||||
"L. c #F9CD6C",
|
||||
"P. c #EDD26C",
|
||||
"I. c #FBD26E",
|
||||
"U. c #E5C374",
|
||||
"Y. c #EDC573",
|
||||
"T. c #E6CB74",
|
||||
"R. c #EECC73",
|
||||
"E. c #EBCA78",
|
||||
"W. c #F5CD74",
|
||||
"Q. c #F9CE72",
|
||||
"!. c #EED77F",
|
||||
"~. c #F4D274",
|
||||
"^. c #FDD473",
|
||||
"/. c #F2D870",
|
||||
"(. c #FED975",
|
||||
"). c #F5D37C",
|
||||
"_. c #FCD57A",
|
||||
"`. c #F7D87A",
|
||||
"'. c #FEDC7C",
|
||||
"]. c #FFE37D",
|
||||
"[. c #DCC682",
|
||||
"{. c #E1C984",
|
||||
"}. c #E4CD8A",
|
||||
"|. c #EFD182",
|
||||
" X c #E5D48D",
|
||||
".X c #EAD28D",
|
||||
"XX c #E8DB8D",
|
||||
"oX c #F1D581",
|
||||
"OX c #FDD581",
|
||||
"+X c #F5DB84",
|
||||
"@X c #FDDC84",
|
||||
"#X c #FEDE89",
|
||||
"$X c #EAD594",
|
||||
"%X c #E1D894",
|
||||
"&X c #ECDA94",
|
||||
"*X c #EFDA99",
|
||||
"=X c #F2DD9C",
|
||||
"-X c #F6E284",
|
||||
";X c #FEE385",
|
||||
":X c #FFE883",
|
||||
">X c #FEE38C",
|
||||
",X c #FEEA8C",
|
||||
"<X c #F6E196",
|
||||
"1X c #FEE594",
|
||||
"2X c #FEEC93",
|
||||
"3X c #F6E39C",
|
||||
"4X c #FEE599",
|
||||
"5X c #FFEB9B",
|
||||
"6X c #FFF195",
|
||||
"7X c #FEF39B",
|
||||
"8X c #FEF99C",
|
||||
"9X c #F5E2A2",
|
||||
"0X c #F9E5A5",
|
||||
"qX c #F6EAA6",
|
||||
"wX c #FFECA3",
|
||||
"eX c #FDEAAB",
|
||||
"rX c #FFF5A0",
|
||||
"tX c #FFF2AB",
|
||||
"yX c #FEF5B3",
|
||||
"uX c #FFF9B3",
|
||||
"iX c #FFFBBB",
|
||||
"pX c #FFFDC1",
|
||||
"aX c None",
|
||||
/* pixels */
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaX* < * < < < < * * & aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaXaXaX* 1 3 5 u u d g Z Z N d u 5 3 * % aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaX< 3 t u A ..c.K.I.I.(.(.'.(.G.2.( d 5 1 & aXaXaXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaX< 5 t g 1.G.H.H.I.(.'.(.I.I.I.K.K.G.I.K.2.V u 1 % aXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaX4 t g c.G.H.I.I.I.].(.(.(.I.G.H.K.G.K.I.G.K.Q.C.C 5 & % aXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaX4 u } v.G.G.I.(.].(.(.(.I.G.G.G.G.G.L.G.K.I.^.^.L.L.:.u < # aXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXt d c.G.I.I.I.I.].(.I.G.c.........:.4.C.W.~.`.'._.^.K.K.J.N 4 # aXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaX5 g v.H.I.I.(.(.(.H.c.[ V V V V A A A ! ( } l.).>X@X_.`._.'.'./ 4 O aXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXt g C.I.(.(.^.(.^.1.( ! C d p u s d d d x M &.3.3.A.).+XOX>X;X;X;X) 3 O aXaXaXaXaXaX",
|
||||
"aXaXaXaXaX5 d G.I.'.].(.^.l.( C A C s H =X=XI 7 N.*X$Xk o.j.z.J.l.W.1X7X6X,X,X,XK 1 X aXaXaXaXaX",
|
||||
"aXaXaXaX3 p C.(.(.'.'.^.*.C C C C B r G eXeXL - [.eX3Xr ~ r.W._.W.J.D.6X8X6X6X6X-Xd & X aXaXaXaX",
|
||||
"aXaXaXaXu ;.'.'.(.^.^.| C c B B B c w z eXeXF = [.eX*X8 K r.@X#X;X`.~.D.7X8X8X6X,XS.y O aXaXaXaX",
|
||||
"aXaXaXw N #X#X'.'.^.*.C c c s r e r 2 r eXeXD $ B.eX=X: z z.oX>X,X,X;X~.D.8X8X6X,X:X) < X aXaXaX",
|
||||
"aXaX3 a T.1X1X>X#XA.! C B s $.6.6.@.@.w.eXeXd.U $XeX9XF z G O.n.!.-X;X'.D./.8X6X,X:X/.u # aXaXaX",
|
||||
"aXaXy K 5X5X5X2X>X-.} ^ C r 0XeXeXeXeXeXeXeXeXeXeXeXeXeXeX9XN.L O.T.`.]./.F.-X6X:X].].) < . aXaX",
|
||||
"aXaXa M.7X5X5X5XU.&.-.&.^ j 0XeXeXeXeXeXeXeXeXeXeXeXeXeXeXeXeX9XL X.~.'.'.K.c.6X:X].].P.t O aXaX",
|
||||
"aX5 k 2X5X5X5X<X-.-.-.-.=.W q.6.9.=XeXeXeXeXs.9.d.B.*XeXeXeXeXeX&Xh <.(.(.Q.F.~.;X].].].b & . aX",
|
||||
"aXy O.5X5X5X5XE.-.-.-.-.-.%.Q z 6 6.eXeXeXeX: , w r 7 R eXeXeXeX0XG ' ~.^.^.F.l.;X].].]. .1 . aX",
|
||||
"aXp n.2X5X5X5Xj.-.-.-.r.r.r.-.=.G 9.eXeXeXeX6 j ( &.} i [.eXeXeXeXY Q J.I.I.L.5.(.;X].(.c.5 X aX",
|
||||
"3 a !.7X5X7X<X-.r.r.r.r.j.r.r.r.W w.eXeXeXeX6 v ,.Q.k.m s.eXeXeXeXL K C.L.L.L.F.D.'.'.(.I.u # ",
|
||||
"5 a ,X5XrXwX+X3.j.j.j.z.z.z.z.r.~ w.eXeXeXeX6 l ;.<._ 0 *XeXeXeX0X0 ( G.L.Q.L.5.C.].'.^.^.g $ ",
|
||||
"4 b 2X7X7XrX!.l.x.x.x.x.U.x.z.z.~ w.eXeXeXeX: , k z Y XeXeXeXeXY r } C.5.5.5.3.4.'.(.^.^.V % . ",
|
||||
"4 N 6X7X7XrXOXx.x.x.W.x.Y.Y.Y.Y.o.d.eXeXeXeX=X=X9XeXeXeXeXeXeX8.+ r [ 3.5.5.3.3.1.'._.(.^.A & . ",
|
||||
"5 N 2X6X5X5XW.x.x.x.x.W.Y.Y.Y.Y.o.d.eXeXeXeXeXeXeXeXeXeXeXeXeXeX[.r C | 1.3.3.3.:._._.^.I./ % ",
|
||||
"5 N ,X2X2X6XD.l.l.x.x.x.Y.Y.Y.R.=.f.eXeXeXeX[.[.[.[.*XeXeXeXeXeXeX*Xj ! *.1.1.1.1._._.^.^./ % ",
|
||||
"5 b ;X,X,X2XU.3.j.x.Y.W.).OX#X@Xt.f.eXeXeXeX: : 7 7 : 6 6.eXeXeXeXeXd.k { *.*.*.1.OX_.(.^.V % ",
|
||||
"4 a ].;X;X>X`.C.L.^._._.OX@X#X#Xt.f.eXeXeXeX6 z #.o.I z 6 w.eXeXeXeX*Xr ! { %.%.,.OX_.(.^.n % ",
|
||||
"4 u /.;X;X;X@XF.Q.Q._._._.@X#X#Xa.f.eXeXeXeX9 I a.Z.y.+.k F eXeXeXeX0Xr Q { { { 4.'.(.^.^.u O ",
|
||||
"aXu V.;X;X;X>XF.K.Q.Q._._.OX#X@Xt.f.eXeXeXeX9 I Z.U.z.=.z 8.eXeXeXeX=X7 Q { { ( A._.^.^.F.5 O ",
|
||||
"aXu ] '.'.;X>XK.J.Q.Q.^._._.~.Z.R w.eXeXeXeX6 S =.>.+.G S 9XeXeXeXeXh.r ! ( ( [ L.L.L.L.:.1 . aX",
|
||||
"aX5 b '.'.'.@X`.F.K.Q.Q.~.A.e.$.P }.eXeXeXeXF L E #.9.[.eXeXeXeXeXeXS k ! ( ! *.H.K.H.L.Z % aX",
|
||||
"aX1 u J.(.'.'.;XC.F.W.Q.K.&.h.eXeXeXeXeXeXeXeXeXeXeXeXeXeXeXeXeXeX@.2 c ! ! ! F.H.L.H.F.w O aX",
|
||||
"aXaXw ( (.(.`.`.`.C.F.K.A.~ [.eXeXeXeXeXeXeXeXeXeXeXeXeXeXeXeX*XF 7 r C B A | H.H.H.H.| 1 X aXaX",
|
||||
"aXaX3 u D.~.~.~.`.D.C.J.V.` .X=X=X3X9X9XeXeX9X=XeXeXeX$X{.9.S 2 r r B B B V 5.H.H.H.H.s + . aXaX",
|
||||
"aXaXaXt / ~.W.~.`.`.5.V.C.>.M i 6 - = q eXeXS o B.eX*Xo 7 r r r B C B r B 1.H.H.L.L.*.5 X . aXaX",
|
||||
"aXaXaX1 u 4.~.~.~.~.~.c.V.l.4.,.~ H i S eXeXF : [.eX=X, r W ^ W W C C W *.Q.Q.Q.Q.J.e % aXaXaX",
|
||||
"aXaXaXaX5 b K.~.~.R.~.`.l.C.J.A.,.=.H P eXeXU , [.eX=X7 v ^ %.^ W ^ ^ -.^.^.W._.W.Z > . aXaXaX",
|
||||
"aXaXaXaX1 5 / ~.~.~.~.~.`.F.F.<.r.,.~ R eXeXY 7 [.eX=Xq ~ 0.r.0.%.o.g.#XOXOXOXOX,.4 O aXaXaXaX",
|
||||
"aXaXaXaXaX1 y } ~.`.`.`.'.#XR.,.r.,.+.X.9.7.I G 9.7.7.X.0.i.i.j.i.9XeX0X=X4X1XT.r # aXaXaXaXaX",
|
||||
"aXaXaXaXaXaX1 u :.'.'.OX#X#X1X+XA.3.r.-.=.=.>.e.i.$.0.0.i.j.g.0XpXpXpXyXuXyXXXk % aXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaX1 p >.>X#X>X1X1X1X1X1X|.U.z.3.j.z.y.i.i.U..XqXpXiXpXpXpXiXiX Xh % . . aXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaX< y _ 3XtXuXtXwX=X4X4X4X5X<X>X=X3X0XeXtXyXuXiXiXiXiXiXuXp.y # . . aXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaX* y J %XpXiXwX4X4X4X5X4X5X5XwXwXwXeXtXeXtXtXyXyXyX&XJ 3 # aXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaX* 3 k R XwX4X1X1X1X1X5X4X5X5XwX5XwXwXtXtXtX&X@.y & X aXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaX& 3 a J t.|.>X,X>X>X2X1X1X1X5X4X0X<Xm.T i > O o aXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaXaX% > w p b _ >.b.S.T.T.U.t.O.N p 4 & O . o aXaXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaX$ $ ; 1 4 5 5 w w 5 3 > % O . . o aXaXaXaXaXaXaXaXaXaXaXaXaXaXaX",
|
||||
"aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXO X X X o X X X o aXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaXaX"
|
||||
};
|
||||
292
src/xpm/bitcoin80.xpm
Normal file
292
src/xpm/bitcoin80.xpm
Normal file
@@ -0,0 +1,292 @@
|
||||
/* XPM */
|
||||
static const char * bitcoin80_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"80 80 206 2",
|
||||
" c #725203",
|
||||
". c #785706",
|
||||
"X c #7B5907",
|
||||
"o c #7C5A09",
|
||||
"O c #7F5F10",
|
||||
"+ c #815E0B",
|
||||
"@ c #85620C",
|
||||
"# c #89650F",
|
||||
"$ c #856313",
|
||||
"% c #896614",
|
||||
"& c #8D6913",
|
||||
"* c #886718",
|
||||
"= c #8D6B1B",
|
||||
"- c #926D14",
|
||||
"; c #926E1B",
|
||||
": c #967116",
|
||||
"> c #997317",
|
||||
", c #95711E",
|
||||
"< c #9B7419",
|
||||
"1 c #9F781B",
|
||||
"2 c #A27B1D",
|
||||
"3 c #8F6F22",
|
||||
"4 c #926F21",
|
||||
"5 c #947323",
|
||||
"6 c #9A7623",
|
||||
"7 c #9D7925",
|
||||
"8 c #957628",
|
||||
"9 c #9A7729",
|
||||
"0 c #9D7B2B",
|
||||
"q c #9D7F33",
|
||||
"w c #A47D23",
|
||||
"e c #A97F27",
|
||||
"r c #A37E2B",
|
||||
"t c #9F8030",
|
||||
"y c #A78021",
|
||||
"u c #AC8425",
|
||||
"i c #A5802D",
|
||||
"p c #AC842B",
|
||||
"a c #AF8829",
|
||||
"s c #B2872C",
|
||||
"d c #B28B2D",
|
||||
"f c #A68333",
|
||||
"g c #AA8633",
|
||||
"h c #AD8A36",
|
||||
"j c #A4863A",
|
||||
"k c #A88638",
|
||||
"l c #A7893B",
|
||||
"z c #AC8B3B",
|
||||
"x c #B28732",
|
||||
"c c #B48C32",
|
||||
"v c #B98E34",
|
||||
"b c #B28D3B",
|
||||
"n c #B88F3C",
|
||||
"m c #B69033",
|
||||
"M c #BD9235",
|
||||
"N c #B4913D",
|
||||
"B c #BC943A",
|
||||
"V c #BE993C",
|
||||
"C c #C19336",
|
||||
"Z c #C1953B",
|
||||
"A c #C49A3C",
|
||||
"S c #C99C3D",
|
||||
"D c #CDA13F",
|
||||
"F c #D0A33F",
|
||||
"G c #A88B40",
|
||||
"H c #B08F40",
|
||||
"J c #AE9142",
|
||||
"K c #AE944C",
|
||||
"L c #B49443",
|
||||
"P c #BB9542",
|
||||
"I c #B49946",
|
||||
"U c #BD9846",
|
||||
"Y c #B3964C",
|
||||
"T c #BB974A",
|
||||
"R c #B6994A",
|
||||
"E c #BF9C4A",
|
||||
"W c #B69B53",
|
||||
"Q c #B99D53",
|
||||
"! c #BCA055",
|
||||
"~ c #BDA25A",
|
||||
"^ c #C49742",
|
||||
"/ c #C49C43",
|
||||
"( c #CB9E42",
|
||||
") c #C49D4B",
|
||||
"_ c #C99E4C",
|
||||
"` c #C29F52",
|
||||
"' c #C5A244",
|
||||
"] c #CDA245",
|
||||
"[ c #C5A34C",
|
||||
"{ c #CCA34B",
|
||||
"} c #CCA94D",
|
||||
"| c #D2A445",
|
||||
" . c #D1A54B",
|
||||
".. c #D5AA4E",
|
||||
"X. c #DBAF4F",
|
||||
"o. c #C6A352",
|
||||
"O. c #CBA554",
|
||||
"+. c #C5AA57",
|
||||
"@. c #CEAC54",
|
||||
"#. c #C4A65A",
|
||||
"$. c #CDA458",
|
||||
"%. c #C2A85F",
|
||||
"&. c #CEAA5B",
|
||||
"*. c #D0A550",
|
||||
"=. c #D4AB53",
|
||||
"-. c #DBAE53",
|
||||
";. c #D0A75B",
|
||||
":. c #D4AC5A",
|
||||
">. c #D9AE5C",
|
||||
",. c #CEB25E",
|
||||
"<. c #D4B156",
|
||||
"1. c #DDB156",
|
||||
"2. c #D4B25C",
|
||||
"3. c #DCB35D",
|
||||
"4. c #D7B85C",
|
||||
"5. c #DCBA5E",
|
||||
"6. c #E2B355",
|
||||
"7. c #E2B65B",
|
||||
"8. c #E4BA5D",
|
||||
"9. c #EABD5E",
|
||||
"0. c #C5AA62",
|
||||
"q. c #CCAE63",
|
||||
"w. c #C6AE69",
|
||||
"e. c #D5AF62",
|
||||
"r. c #CEB167",
|
||||
"t. c #CCB36C",
|
||||
"y. c #D5B162",
|
||||
"u. c #DCB462",
|
||||
"i. c #D7B964",
|
||||
"p. c #DCBC64",
|
||||
"a. c #D2B66B",
|
||||
"s. c #DCB669",
|
||||
"d. c #D7BE69",
|
||||
"f. c #DFB86A",
|
||||
"g. c #D0B771",
|
||||
"h. c #D2BA74",
|
||||
"j. c #D5BE78",
|
||||
"k. c #E1B766",
|
||||
"l. c #E4BB63",
|
||||
"z. c #E9BE63",
|
||||
"x. c #E3BB6A",
|
||||
"c. c #E9BF6A",
|
||||
"v. c #E1BE72",
|
||||
"b. c #DDC16B",
|
||||
"n. c #DAC27E",
|
||||
"m. c #E4C164",
|
||||
"M. c #ECC264",
|
||||
"N. c #E4C36B",
|
||||
"B. c #EBC36C",
|
||||
"V. c #E7C96F",
|
||||
"C. c #EECA6E",
|
||||
"Z. c #F1C564",
|
||||
"A. c #F1C76A",
|
||||
"S. c #F5CB6C",
|
||||
"D. c #FACE6D",
|
||||
"F. c #F4D06F",
|
||||
"G. c #FCD06E",
|
||||
"H. c #E5C371",
|
||||
"J. c #EDC573",
|
||||
"K. c #E4CA73",
|
||||
"L. c #ECCC74",
|
||||
"P. c #E7CF7A",
|
||||
"I. c #EBCD7A",
|
||||
"U. c #F3CD73",
|
||||
"Y. c #F8CE71",
|
||||
"T. c #F3CD7A",
|
||||
"R. c #EDD076",
|
||||
"E. c #EDD17B",
|
||||
"W. c #F4D274",
|
||||
"Q. c #FBD274",
|
||||
"!. c #FED977",
|
||||
"~. c #F3D47B",
|
||||
"^. c #FDD47A",
|
||||
"/. c #F5DA7C",
|
||||
"(. c #FDDA7C",
|
||||
"). c #FFE07F",
|
||||
"_. c #DBC481",
|
||||
"`. c #DFC885",
|
||||
"'. c #E1CA86",
|
||||
"]. c #EACC80",
|
||||
"[. c #E4CD8A",
|
||||
"{. c #EED383",
|
||||
"}. c #E7D18F",
|
||||
"|. c #EAD38C",
|
||||
" X c #F4D680",
|
||||
".X c #FDD780",
|
||||
"XX c #F5DA83",
|
||||
"oX c #FCDC84",
|
||||
"OX c #F5DB8A",
|
||||
"+X c #FADE89",
|
||||
"@X c #EAD492",
|
||||
"#X c #EED896",
|
||||
"$X c #EFDA9A",
|
||||
"%X c #F1DD9D",
|
||||
"&X c #FDE283",
|
||||
"*X c #F6E18D",
|
||||
"=X c #FEE48D",
|
||||
"-X c #FFE692",
|
||||
";X c #FFE894",
|
||||
":X c #FBE799",
|
||||
">X c #FFEA98",
|
||||
",X c #F6E2A3",
|
||||
"<X c #FAE6A6",
|
||||
"1X c #FAE7A8",
|
||||
"2X c #FDEAAB",
|
||||
"3X c None",
|
||||
/* pixels */
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u u u u y y u y 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u u u u u u a u u u u u u a u u 2 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u u u u u s m V D ' { ' D M d u u a u u u u 2 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u u u M } m.~.oX=X=X=X=X=X-X-X=X&X/.m.=.V u u a u u w 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u u M 4.~.=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X/.5.Z u u u u u 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u ] V.&X=X=X&X=X=X=X=X=X=X=X=X=X&X=X=X=X=X=X=X=X=X=X=XW.} a u u u 2 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu a u u ' W.=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X+X=X=X=X&X=X=X=X~.} a u u u < 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u M N.=X&X=X=X=X=X=X=X=X-X=X=X=X=X&X=X=X=XoX=X=X=X=X&X+X=X=X=X=X=X=X=XL.M u u u < 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u u } XX=X=X=X&X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X*X=X=X=X=X=X=X=X=X=X=X=X=X=X=XoX<.a u u 2 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u s m.&X=X=X=X=X=X=X=X=X=X=X=X=X=X/.L.M.m.9.m.9.m.C.~.&X*X=X=X=X=X=X=X=X=X=X=X=X=XV.m u u 2 o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3Xu u u c R.=X=X=X=X=X=X=X=X=X=X=XoXC.1.| S S A S D D D D ] ] ..<.N./.=X-X=X-X=X=X=X=X=X=X=XXXZ u a 2 o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3Xu u u m XX=X=X=X=X=X=X=X=X=X=XW.3.| ^ A C M M M C S S A A A / ( { =.<.l.I.=X-X-X=X=X=X=X=X=X=X=XV a u 2 . 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3Xu u m /.=X=X=X-X=X=X=X=X=X~.1.D ] S Z v x p s u s d d v c c v V { =.7.8.7.l.T.=X-X=X-X-X-X-X-X=X=XV u a 1 3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3Xu u d /.=X=X=X=X=X=X=X=X&X8.^ A ( S M v e $.r.e.r.u w i a.a.a.&.b ^ =.l.l.l.c.z.z.XX-X-X-X-X=X-X-X;X&XV u u : 3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3Xu u s R.=X=X=X=X=X=X=X=XU.{ ^ Z C ( A M u w [.2X2X2X0 - 7 2X2X1X@Xi P *.l.x.B.U.C.z.z.W.-X-X-X-X-X-X=X-X*Xd a u # . 3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3Xu u u l.=X=X=X=X-X=X=X=Xm.Z Z Z Z n Z Z v e , '.2X2X2X5 & ; 2X2X2X}.7 b { 3.x.^.^.^.Y.A.z.R.-X;X;X;X;X-X;X-XP.a u y . 3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3Xu u } -X-X=X-X=X=X=X=Xl.M M Z C C C C C x e ; '.2X2X2X, $ = 2X2X2X}.6 h ) >.J..X.X.X.X(.W.Z.C.&X;X;X;X;X-X-X-X<.u u < 3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3Xu u c oX=X=X=X=X=X=X=Xl.Z C M M C C v v v s w = '.2X2X2X5 $ = 2X2X2X}.5 g ) u./.+X+X=X=X=X&XW.Z.F.=X;X;X;X;X-X-X*XV u y @ X 3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3Xu u u N.-X-X-X-X=X=X=XB.Z M C v v s e e e e w > % `.2X2X2X= + % 2X2X2X}.= r L 4.E.OX+X-X=X=X&X).W.M.R.;X;X;X-X-X-X;XR.u u y 3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3Xu u U -X-X-X-X-X-X=XW.^ C C C x e e r 6 5 4 ; = $ `.2X2X2X= O = 2X2X2X}.O = t Q ,.b.P./.*X=X&X&X).F.M.W.;X;X;X;X&X-X&X} u u O 3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xu u u R.-X-X-X-X-X-X=X=.{ ^ Z C x n 2X2X<X<X1X2X<X<X2X2X2X2X1X1X<X2X2X2X<X$X[.b.~ J I ~ b.P.&X&X&X).!.F.m.).;X;X;X;X;X&X).u y y 3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xu u U -X-X-X-X-X-X-Xc.=.=. ._ ^ x z 2X2X1X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X<Xn.l I ,.K./.).).).F.Z.Z.&X;X;X=X-X-X&X} u u O 3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xu u V.-X;X-X-X-X-XOX>.>.>.=.=._ n b 2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X:XI N +.V./.).).F.F.9.W.;X=X;X-X-X-XR.u u > 3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xu u d =X;X-X-X-X-X-Xx.>.>.>.>.>...^ P 2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X,Xl N 4.R.!.!.!.G.Z.M.&X;X=X=X-X-X-XB a u 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xu u @.;X;X-X;X;X;XXX>.:.>.>.>.>.>._ P ` Y Y W _.2X2X2X2X2X2X@XW W ~ 0.t.'.<X2X2X2X2X2X2X2X2X'.0 ' m./.!.!.Q.S.9.F.=X;X-X=X-X&X4.u u @ 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xu u P.;X;X;X;X-X:XN.>.>.>.>.>.>.>.=._ P z r 4 8 2X2X2X2X2X2X_.. $ , 6 1 3 t ~ 1X2X2X2X2X2X2X2Xt B 5.G.!.!.G.G.M.9.&X;X=X-X-X=X/.u u > 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3Xu u d =X;X;X=X;X;X=X3.>.>.>.e.>.3.3.>.:.*._ P r 9 2X2X2X2X2X1Xn.@ , c B N m h 8 ~ 2X2X2X2X2X2X2XI h <.F.!.G.G.F.M.9.W.;X=X-X-X=X=Xm u y . 3X3X3X3X3X3X",
|
||||
"3X3X3X3Xu u ' -X-X>X-X-X-X X>.>.>.>.>.>.>.u.u.u.u.3.$.P f 2X2X2X2X2X2X_.$ i / -.<.8.} h 8 1X2X2X2X2X2X2X! i <.S.G.G.G.G.Z.9.Z.=X-X=X-X&X-X} u u X 3X3X3X3X3X3X",
|
||||
"3X3X3X3Xu u 4.-X-X-X-X-X-XJ.3.>.>.k.k.k.k.k.u.k.u.u.:.U k 2X2X2X2X2X1X_.% f } 8.Z.F.8.U 8 ,X2X2X2X2X2X2XI g } Z.D.G.D.G.D.Z.9.&X-X=X=X=X-Xm.u u @ 3X3X3X3X3X3X",
|
||||
"3X3X3X3Xu u K.;X-X;X-X>X-Xk.3.k.k.k.k.k.k.k.k.k.k.u.e.U k 2X2X2X2X2X2X_.% f [ 8.F.M.<.b i 2X2X2X2X2X2X2Xt a X.Z.D.D.D.G.G.Z.9./.=X-X=X=X=XR.u u & 3X3X3X3X3X3X",
|
||||
"3X3X3X3Xu u E.;X-X;X-X-X=Xl.l.x.c.k.x.k.k.x.x.v.x.x.u.) z 2X2X2X2X2X2X_.$ 7 L <.<.} N 6 h.2X2X2X2X2X2X_.: V 1.S.D.D.G.D.S.M.6.W.-X=X-X=X=X&Xu u > X 3X3X3X3X3X",
|
||||
"3X3X3Xu a u =X;X;X;X;X;XoX7.z.c.c.c.c.c.c.c.c.c.x.k.u.) z 2X2X2X2X2X2Xn.o = i N h i l n.2X2X2X2X2X2X<Xt t D 7.M.Z.z.z.9.9.9.6.M.-X=X=X=X;X=Xm u 1 3X3X3X3X3X",
|
||||
"3X3X3Xy u a =X;X;X;X;X;XXXl.z.c.c.c.c.T.J.J.T.v.J.J.s.` z 2X2X2X2X2X2X#XW ~ ~ t.n.$X2X2X2X2X2X2X2X,Xt % t V X.8.9.8.9.9.9.6.6.M.-X=X=X=X=X&XM u 2 3X3X3X3X3X",
|
||||
"3X3X3Xu u m -X-X-X;X;X;X~.z.z.c.c.c.c..XJ.J.J.J.J.J.x.O.b 2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2Xw.$ * y V X.7.8.8.9.7.8.7.6.8.=X=X-X-X=X-XV a y 3X3X3X3X3X",
|
||||
"3X3X3Xu a m -X-X-X;X;X;X~.7.z.c.c.c.c.c.c.J.T.J.T.J.B.O.b 2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X,X~ , c ' X.6.6.7.6.6.6.6.8.=X=X=X-X&X-XV u y 3X3X3X3X3X",
|
||||
"3X3X3Xu u m -X-X-X-X-X-X/.8.l.z.c.T.c.J.c.J.T.v.J.J.x.O.G 2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2Xn.r v { 6.6.6.6.6.6.-.7.&X-X=X=X=X-XD u y 3X3X3X3X3X",
|
||||
"3X3X3Xu u d =X-X-X-X-X-X~.7.z.z.c.c.c.c.c.J.c.T.T.^.T.y.R 2X2X2X2X2X2X@XK K W W W ~ h.#X1X2X2X2X2X2X2X2X2Xa.i Z ..X.6.6.-.-.6.7.-X-X-X-X-X-XD u 2 3X3X3X3X3X",
|
||||
"3X3X3Xw u a =X-X-X-X-X-X~.7.7.8.c.c.c.c.T..X.X+X+X+XXXi.R 2X2X2X2X2X2Xn.. * 5 8 5 3 = * q `.2X2X2X2X2X2X2X<Xk c | X.6.-.-.-.-.z.&X;X=X;X-X;XV u w 3X3X3X3X3X",
|
||||
"3X3X3Xu u u =X-X=X-X-X-X/.8.M.B.Y.T.^.^.^..X.XoXoX+XXXi.R 2X2X2X2X2X2X_.$ 0 b U U N l t 5 $ `.2X2X2X2X2X2X2X0.e Z .....-.-.6.c.;X=X;X=X;X-Xd u 1 3X3X3X3X3X",
|
||||
"3X3X3X3Xu a E.-X-X-X-X-X=Xz.S.D.Y.^.Q.^.^.^..XoX+X+XXXi.R 2X2X2X2X2X2X_.= l +.u.i.,.O.E h 5 G 2X2X2X2X2X2X2X_.0 n | . .*. .*.T.-X;X;X;X-X=Xa u : 3X3X3X3X3X",
|
||||
"3X3X3X3Xu u N.-X-X-X=X-X-XA.Z.S.Y.Q.Q.^.^..X.XoXoX&X.Xi.R 2X2X2X2X2X2X_.= N y.H.H.m.i.y.E f 8 2X2X2X2X2X2X2X'.6 n | . . . . ..X;X;X;X;X-X~.u u & 3X3X3X3X3X",
|
||||
"3X3X3X3Xu u <.-X-X=X=X-X-XW.Z.S.Y.Y.Q.^.^.^.(..XoX=XXXi.R 2X2X2X2X2X2X_.= L 4.H.J.H.x.i.o.k j 2X2X2X2X2X2X2X_.6 B . . . .{ =.-X;X-X;X-X-Xb.a u @ 3X3X3X3X3X",
|
||||
"3X3X3X3Xy a V =X=X-X-X=X-XXXZ.S.Y.Y.Y.Q.!.^..X.XoXoXE.y.I 2X2X2X2X2X2X_.= J y.b.H.N.p.&.P 0 g.2X2X2X2X2X2X2Xr.r B _ { .| ] l.-X;X;X-X-X;X..u u . . 3X3X3X3X3X",
|
||||
"3X3X3X3Xy u a =X=X=X=X-X=X-XM.Z.S.Y.Y.Q.Q.^.^.^.U.J.u.E l 2X2X2X2X2X2X_.* k o.e.e.$.` P q W 1X2X2X2X2X2X2X2XG i B ] | ] ] ( ~.=X;X;X;X;X;XM u y 3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xu u V.-X=X-X=X-X-XF.M.A.D.Y.Q.Y.Q.Y.B.2.[ N 0 j 2X2X2X2X2X2X_.O 5 l G z H H Q _.2X2X2X2X2X2X2X2X#X, g ^ ] ] | ] ..-X-X-X-X&X;X).u u : 3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xu u } =X=X=X=X-X=X&XM.Z.S.D.W.Q.Y.B.*.a.#X@X|.,X2X2X2X2X2X2X,X[.[.}.}.%X<X2X2X2X2X2X2X2X2X2X2X<Xj 6 b / ] ] ] ] M.-X-X-X-X-X-X4.u u O 3X3X3X3X3X3X",
|
||||
"3X3X3X3X3Xy u d =X=X=X=X=X=X-XS.M.A.S.S.U.A.u.) n.2X2X2X2X2X2X2X2X2X2X2X2X1X2X2X2X2X2X2X2X2X2X2X2X2X2X2XW ; i M ( S S S ] &X-X-X-X-X=X-Xm u y . X 3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xu u p.=X=X=X=X=X-X&X9.Z.C.S.S.M.:.b [.2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X%XG = r x v C D D D m.-X-X-X-X-X-XR.u u : 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xy u B =X=X=X=X=X=X=XF.9.M.A.C.M.=.h %X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X2X1X#X~ 4 ; r p v v M C A | &X-X-X-X-X-X-X] u u X 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3Xy u u N.=X=X-X=X-X=X=XM.z.M.M.M.1.V #X%X%X%X%X$X%X%X<X2X2X2X%X$X%X2X2X2X<X[.n.t.W q = , r i x v C C C M C W.-X-X-X-X-X-X/.u u 1 X 3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3Xu u V *X=X=X*X=X=X=XoX8.M.M.M.5.{ m r , ; $ $ o o `.2X2X2X3 o $ 2X2X2X[.o $ 4 9 0 r g x v m C M C C C 8.&X-X-X-X-X-X-X[ u u @ 3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X2 u u 5.=X=X=X=X=X=X=XI.8.M.M.z.3.O.) P b r 0 4 % `.2X2X2X3 $ * 2X2X2X[.$ 4 r e ^ n n Z Z Z C C C M | =X=X-X-X-X-X-XR.u u < 3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3Xy u d XX=X=X=X=X-X=X=XS.8.8.M.M.z.z.7.{ _ U g 5 `.2X2X2X8 = 3 2X2X2X}.3 0 x ^ _ ^ ^ ^ Z ^ B ^ C .&X-X-X-X-X-X-X=XB u u o 3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X1 u u ' =X=X*X=X=X*X=X=XW.8.M.M.A.S.l.u.>.o.L r [.2X2X2X9 = 8 2X2X2X}.4 r ^ _ *.*._ ) ) ^ ^ ^ O.oX=X-X-X-X-X-X-X<.u u : . 3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3Xy u u i.=X=X=X=X=X-X*X=XW.9.M.A.B.3.5.5.;.U f [.2X2X2Xq 4 8 2X2X2X}.r q _ _ ;.;.*._ _ ` _ e.+X-X-X-X-X-X-X-XR.a u 2 3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3Xu u u K.=X=X=X-X=X=X=X=XXXz.M.8.5.8.u.:.) h }.2X2X2Xj r f 2X2X2X@Xq T _ e.e.u.e.;.$.$.b.-X-X-X=X;X=X;X-X&Xa a u + 3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3Xu u d ~.=X=X=X=X=X-X=X-X+XC.3.5.7.7.2.@.) q.r.q.q.H H L g.r.w.q.T ` e.k.v.k.k.s.s.{.-X-X;X-X;X;X;X;X*XV u u & . 3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X2 u u c XX-X=X=X=X=X-X=X-X-X Xl.7.7.u.2.$.o.[ [ o.O.$.&.&.` ` ` q.s.k.v.k.k.x.{.%X>X>X>X;X>X;X>X>X*XV u u > 3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X2 u u m ~.=X-X-X-X=X-X-X-X-X-X Xc.7.5.u.3.e.y.u.s.f.k.s.e.e.s.s.k.k.k.v. X:X>X>X>X>X>X>X;X>X>X*XV u u < 3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X2 u u d R.-X=X-X=X-X-X-X-X-X-X-X+XI.v.u.s.l.k.k.x.x.x.s.s.s.s.j.].+X>X>X>X>X>X:X>X>X>X>X>XOXV u u 1 3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X2 u u a p.-X-X-X;X;X;X-X-X-X:X-X-X-X-XOX XL.J.J.J.L.I.].OX:X>X-X>X>X-X>X>X>X>X>X>X>X>XK.a a u < 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X2 u u u @.=X;X;X>X;X-X-X>X-X-X-X-X;X-X-X-X-X-X>X>X-X>X-X>X>X>X>X;X>X>X>X-X>X-X-X:X<.u u u > 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X1 u u u m n.>X;X>X>X-X-X-X-X>X-X-X-X;X;X;X-X-X-X-X-X>X-X-X>X-X>X>X-X>X>X>X>XK.B u u u & 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xw u u u / {.>X>X-X-X-X-X-X-X-X-X-X-X;X-X-X;X:X-X-X>X-X:X>X;X;X>X;X;X{.[ u u u w + 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X2 u u u u ) K.-X-X-X-X:X-X-X-X-X-X-X-X-X-X-X-X-X>X-X-X-X-X-X-XE.[ u u u u - . 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X1 u u u u m 2.E.-X+X:X-X-X-X-X-X-X-X-X-X:X-X-X-X;X-XOXi.B u u u u 1 o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X> u u u u u v [ l.I.OX-X-X-X-X-X-X-X-X+XI.f.@.m u u u u u 1 + o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X& 2 u u u u u u u d B V V V V B d u u u u u u u y - . o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X+ - 1 u u u u u u u a u u u u u u u u 2 - o o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xo . X # - > 1 2 2 2 1 2 > - # o . o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3Xo o . o 3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X",
|
||||
"3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X3X"
|
||||
};
|
||||
41
src/xpm/check.xpm
Normal file
41
src/xpm/check.xpm
Normal file
@@ -0,0 +1,41 @@
|
||||
/* XPM */
|
||||
static const char * check_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 3 1",
|
||||
" c #008000",
|
||||
". c #00FF00",
|
||||
"X c None",
|
||||
/* pixels */
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXX . XXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX .. XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXX . XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX .. XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX XX . XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX . .. XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXX .. . XXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXX ... XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXX . XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||
};
|
||||
278
src/xpm/send16.xpm
Normal file
278
src/xpm/send16.xpm
Normal file
@@ -0,0 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * send16_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k i ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k t : ",
|
||||
"l k k k k k k k s j 7 j k q = X ",
|
||||
"X $ = = = = = k g 7 j k 9 & X X ",
|
||||
"X X X X X X X k 2 j k 6 $ X X X ",
|
||||
"X X X X X X X k j k 5 + X X X X ",
|
||||
"X X X X X X X k k 1 + X X X X X ",
|
||||
"X X X X X X X = , X X X X X X X "
|
||||
};
|
||||
278
src/xpm/send16noshadow.xpm
Normal file
278
src/xpm/send16noshadow.xpm
Normal file
@@ -0,0 +1,278 @@
|
||||
/* XPM */
|
||||
static const char * send16noshadow_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 256 2",
|
||||
" c #ADF7AD",
|
||||
". c #9CFF9C",
|
||||
"X c None",
|
||||
"o c #ADEFAD",
|
||||
"O c #94FF94",
|
||||
"+ c #D6CECE",
|
||||
"@ c #8CFF8C",
|
||||
"# c #CECECE",
|
||||
"$ c #CECEC5",
|
||||
"% c #84FF84",
|
||||
"& c #CEC5C5",
|
||||
"* c #73FF73",
|
||||
"= c #C5C5C5",
|
||||
"- c #6BFF6B",
|
||||
"; c #73F773",
|
||||
": c #C5BDBD",
|
||||
"> c #6BF76B",
|
||||
", c #BDBDBD",
|
||||
"< c #63F763",
|
||||
"1 c #B5B5B5",
|
||||
"2 c #52F752",
|
||||
"3 c #42FF42",
|
||||
"4 c #3AFF3A",
|
||||
"5 c #ADADAD",
|
||||
"6 c #ADADA5",
|
||||
"7 c #4AEF4A",
|
||||
"8 c #29FF29",
|
||||
"9 c #A5A5A5",
|
||||
"0 c #42E642",
|
||||
"q c #9CA59C",
|
||||
"w c #3AE63A",
|
||||
"e c #10FF10",
|
||||
"r c #08FF08",
|
||||
"t c #949C94",
|
||||
"y c #00FF00",
|
||||
"u c #00F700",
|
||||
"i c #8C948C",
|
||||
"p c #00EF00",
|
||||
"a c #08E608",
|
||||
"s c #10DE10",
|
||||
"d c #00E600",
|
||||
"f c #00DE00",
|
||||
"g c #19C519",
|
||||
"h c #00CE00",
|
||||
"j c #00C500",
|
||||
"k c #008C00",
|
||||
"l c #008400",
|
||||
"z c #669900",
|
||||
"x c #999900",
|
||||
"c c #CC9900",
|
||||
"v c #FF9900",
|
||||
"b c #00CC00",
|
||||
"n c #33CC00",
|
||||
"m c #66CC00",
|
||||
"M c #99CC00",
|
||||
"N c #CCCC00",
|
||||
"B c #FFCC00",
|
||||
"V c #66FF00",
|
||||
"C c #99FF00",
|
||||
"Z c #CCFF00",
|
||||
"A c #000033",
|
||||
"S c #330033",
|
||||
"D c #660033",
|
||||
"F c #990033",
|
||||
"G c #CC0033",
|
||||
"H c #FF0033",
|
||||
"J c #003333",
|
||||
"K c #333333",
|
||||
"L c #663333",
|
||||
"P c #993333",
|
||||
"I c #CC3333",
|
||||
"U c #FF3333",
|
||||
"Y c #006633",
|
||||
"T c #336633",
|
||||
"R c #666633",
|
||||
"E c #996633",
|
||||
"W c #CC6633",
|
||||
"Q c #FF6633",
|
||||
"! c #009933",
|
||||
"~ c #339933",
|
||||
"^ c #669933",
|
||||
"/ c #999933",
|
||||
"( c #CC9933",
|
||||
") c #FF9933",
|
||||
"_ c #00CC33",
|
||||
"` c #33CC33",
|
||||
"' c #66CC33",
|
||||
"] c #99CC33",
|
||||
"[ c #CCCC33",
|
||||
"{ c #FFCC33",
|
||||
"} c #33FF33",
|
||||
"| c #66FF33",
|
||||
" . c #99FF33",
|
||||
".. c #CCFF33",
|
||||
"X. c #FFFF33",
|
||||
"o. c #000066",
|
||||
"O. c #330066",
|
||||
"+. c #660066",
|
||||
"@. c #990066",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k o j k X X X X X ",
|
||||
"X X X X X X X k * o j k X X X X ",
|
||||
"l k k k k k k k * * . j k X X X ",
|
||||
"l @ @ @ @ @ @ @ 4 e e % j k X X ",
|
||||
"l O 3 8 e r r r r r r e ; j k X ",
|
||||
"l @ e e r r r r r u p a f < j k ",
|
||||
"l @ r u p a a a a a f f w j k X ",
|
||||
"l O ; ; ; ; ; < a f b 0 j k X X ",
|
||||
"l k k k k k k k s j 7 j k X X X ",
|
||||
"X X X X X X X k g 7 j k X X X X ",
|
||||
"X X X X X X X k 2 j k X X X X X ",
|
||||
"X X X X X X X k j k X X X X X X ",
|
||||
"X X X X X X X k k X X X X X X X ",
|
||||
"X X X X X X X X X X X X X X X X "
|
||||
};
|
||||
282
src/xpm/send20.xpm
Normal file
282
src/xpm/send20.xpm
Normal file
@@ -0,0 +1,282 @@
|
||||
/* XPM */
|
||||
static const char * send20_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 256 2",
|
||||
" c #CEFFCE",
|
||||
". c #BDFFBD",
|
||||
"X c #C5F7C5",
|
||||
"o c #B5FFB5",
|
||||
"O c #ADFFAD",
|
||||
"+ c #A5FFA5",
|
||||
"@ c #9CFF9C",
|
||||
"# c None",
|
||||
"$ c #94FF94",
|
||||
"% c #D6CECE",
|
||||
"& c #8CFF8C",
|
||||
"* c #CECEC5",
|
||||
"= c #84FF84",
|
||||
"- c #94EF94",
|
||||
"; c #7BFF7B",
|
||||
": c #CEC5C5",
|
||||
"> c #73FF73",
|
||||
", c #C5C5C5",
|
||||
"< c #C5C5BD",
|
||||
"1 c #6BFF6B",
|
||||
"2 c #BDC5B5",
|
||||
"3 c #63FF63",
|
||||
"4 c #6BF76B",
|
||||
"5 c #BDBDBD",
|
||||
"6 c #BDBDB5",
|
||||
"7 c #5AFF5A",
|
||||
"8 c #63F763",
|
||||
"9 c #B5BDB5",
|
||||
"0 c #B5BDAD",
|
||||
"q c #52FF52",
|
||||
"w c #BDB5B5",
|
||||
"e c #5AF75A",
|
||||
"r c #B5B5B5",
|
||||
"t c #B5B5AD",
|
||||
"y c #52F752",
|
||||
"u c #42FF42",
|
||||
"i c #52EF52",
|
||||
"p c #ADADAD",
|
||||
"a c #ADADA5",
|
||||
"s c #4AEF4A",
|
||||
"d c #31FF31",
|
||||
"f c #29FF29",
|
||||
"g c #A5A5A5",
|
||||
"h c #21FF21",
|
||||
"j c #5AD65A",
|
||||
"k c #42E642",
|
||||
"l c #94AD94",
|
||||
"z c #4ADE4A",
|
||||
"x c #3AE63A",
|
||||
"c c #5ACE5A",
|
||||
"v c #10FF10",
|
||||
"b c #9C9C9C",
|
||||
"n c #31E631",
|
||||
"m c #08FF08",
|
||||
"M c #949C94",
|
||||
"N c #84A584",
|
||||
"B c #00FF00",
|
||||
"V c #3AD63A",
|
||||
"C c #52C552",
|
||||
"Z c #00F700",
|
||||
"A c #8C948C",
|
||||
"S c #849484",
|
||||
"D c #00EF00",
|
||||
"F c #739C73",
|
||||
"G c #08E608",
|
||||
"H c #4AB54A",
|
||||
"J c #31C531",
|
||||
"K c #00E600",
|
||||
"L c #739473",
|
||||
"P c #00DE00",
|
||||
"I c #63945A",
|
||||
"U c #6B8C6B",
|
||||
"Y c #00D600",
|
||||
"T c #42A542",
|
||||
"R c #638C63",
|
||||
"E c #00CE00",
|
||||
"W c #21B521",
|
||||
"Q c #5A8C5A",
|
||||
"! c #00C500",
|
||||
"~ c #528C52",
|
||||
"^ c #3A9C3A",
|
||||
"/ c #4A8C4A",
|
||||
"( c #00BD00",
|
||||
") c #319431",
|
||||
"_ c #219C21",
|
||||
"` c #318C31",
|
||||
"' c #3A843A",
|
||||
"] c #219421",
|
||||
"[ c #298C29",
|
||||
"{ c #318431",
|
||||
"} c #218C21",
|
||||
"| c #218C19",
|
||||
" . c #198C19",
|
||||
".. c #218421",
|
||||
"X. c #297B29",
|
||||
"o. c #198419",
|
||||
"O. c #217B21",
|
||||
"+. c #108410",
|
||||
"@. c #197B19",
|
||||
"#. c #CC0066",
|
||||
"$. c #FF0066",
|
||||
"%. c #003366",
|
||||
"&. c #333366",
|
||||
"*. c #663366",
|
||||
"=. c #993366",
|
||||
"-. c #CC3366",
|
||||
";. c #FF3366",
|
||||
":. c #006666",
|
||||
">. c #336666",
|
||||
",. c #666666",
|
||||
"<. c #996666",
|
||||
"1. c #CC6666",
|
||||
"2. c #009966",
|
||||
"3. c #339966",
|
||||
"4. c #669966",
|
||||
"5. c #999966",
|
||||
"6. c #CC9966",
|
||||
"7. c #FF9966",
|
||||
"8. c #00CC66",
|
||||
"9. c #33CC66",
|
||||
"0. c #99CC66",
|
||||
"q. c #CCCC66",
|
||||
"w. c #FFCC66",
|
||||
"e. c #00FF66",
|
||||
"r. c #33FF66",
|
||||
"t. c #99FF66",
|
||||
"y. c #CCFF66",
|
||||
"u. c #FF00CC",
|
||||
"i. c #CC00FF",
|
||||
"p. c #009999",
|
||||
"a. c #993399",
|
||||
"s. c #990099",
|
||||
"d. c #CC0099",
|
||||
"f. c #000099",
|
||||
"g. c #333399",
|
||||
"h. c #660099",
|
||||
"j. c #CC3399",
|
||||
"k. c #FF0099",
|
||||
"l. c #006699",
|
||||
"z. c #336699",
|
||||
"x. c #663399",
|
||||
"c. c #996699",
|
||||
"v. c #CC6699",
|
||||
"b. c #FF3399",
|
||||
"n. c #339999",
|
||||
"m. c #669999",
|
||||
"M. c #999999",
|
||||
"N. c #CC9999",
|
||||
"B. c #FF9999",
|
||||
"V. c #00CC99",
|
||||
"C. c #33CC99",
|
||||
"Z. c #66CC66",
|
||||
"A. c #99CC99",
|
||||
"S. c #CCCC99",
|
||||
"D. c #FFCC99",
|
||||
"F. c #00FF99",
|
||||
"G. c #33FF99",
|
||||
"H. c #66CC99",
|
||||
"J. c #99FF99",
|
||||
"K. c #CCFF99",
|
||||
"L. c #FFFF99",
|
||||
"P. c #0000CC",
|
||||
"I. c #330099",
|
||||
"U. c #6600CC",
|
||||
"Y. c #9900CC",
|
||||
"T. c #CC00CC",
|
||||
"R. c #003399",
|
||||
"E. c #3333CC",
|
||||
"W. c #6633CC",
|
||||
"Q. c #9933CC",
|
||||
"!. c #CC33CC",
|
||||
"~. c #FF33CC",
|
||||
"^. c #0066CC",
|
||||
"/. c #3366CC",
|
||||
"(. c #666699",
|
||||
"). c #9966CC",
|
||||
"_. c #CC66CC",
|
||||
"`. c #FF6699",
|
||||
"'. c #0099CC",
|
||||
"]. c #3399CC",
|
||||
"[. c #6699CC",
|
||||
"{. c #9999CC",
|
||||
"}. c #CC99CC",
|
||||
"|. c #FF99CC",
|
||||
" X c #00CCCC",
|
||||
".X c #33CCCC",
|
||||
"XX c #66CCCC",
|
||||
"oX c #99CCCC",
|
||||
"OX c #CCCCCC",
|
||||
"+X c #FFCCCC",
|
||||
"@X c #00FFCC",
|
||||
"#X c #33FFCC",
|
||||
"$X c #66FF99",
|
||||
"%X c #99FFCC",
|
||||
"&X c #CCFFCC",
|
||||
"*X c #FFFFCC",
|
||||
"=X c #3300CC",
|
||||
"-X c #6600FF",
|
||||
";X c #9900FF",
|
||||
":X c #0033CC",
|
||||
">X c #3333FF",
|
||||
",X c #6633FF",
|
||||
"<X c #9933FF",
|
||||
"1X c #CC33FF",
|
||||
"2X c #FF33FF",
|
||||
"3X c #0066FF",
|
||||
"4X c #3366FF",
|
||||
"5X c #6666CC",
|
||||
"6X c #9966FF",
|
||||
"7X c #CC66FF",
|
||||
"8X c #FF66CC",
|
||||
"9X c #0099FF",
|
||||
"0X c #3399FF",
|
||||
"qX c #6699FF",
|
||||
"wX c #9999FF",
|
||||
"eX c #CC99FF",
|
||||
"rX c #FF99FF",
|
||||
"tX c #00CCFF",
|
||||
"yX c #33CCFF",
|
||||
"uX c #66CCFF",
|
||||
"iX c #99CCFF",
|
||||
"pX c #CCCCFF",
|
||||
"aX c #FFCCFF",
|
||||
"sX c #33FFFF",
|
||||
"dX c #66FFCC",
|
||||
"fX c #99FFFF",
|
||||
"gX c #CCFFFF",
|
||||
"hX c #FF6666",
|
||||
"jX c #66FF66",
|
||||
"kX c #FFFF66",
|
||||
"lX c #6666FF",
|
||||
"zX c #FF66FF",
|
||||
"xX c #66FFFF",
|
||||
"cX c #A50021",
|
||||
"vX c #5F5F5F",
|
||||
"bX c #777777",
|
||||
"nX c #868686",
|
||||
"mX c #969696",
|
||||
"MX c #CBCBCB",
|
||||
"NX c #B2B2B2",
|
||||
"BX c #D7D7D7",
|
||||
"VX c #DDDDDD",
|
||||
"CX c #E3E3E3",
|
||||
"ZX c #EAEAEA",
|
||||
"AX c #F1F1F1",
|
||||
"SX c #F8F8F8",
|
||||
"DX c #FFFBF0",
|
||||
"FX c #A0A0A4",
|
||||
"GX c #808080",
|
||||
"HX c #FF0000",
|
||||
"JX c #00FF00",
|
||||
"KX c #FFFF00",
|
||||
"LX c #0000FF",
|
||||
"PX c #FF00FF",
|
||||
"IX c #00FFFF",
|
||||
"UX c #FFFFFF",
|
||||
/* pixels */
|
||||
"# # # # # # # # # # # # # # # # # # # # ",
|
||||
"# # # # # # # ` 0 # # # # # # # # # # # ",
|
||||
"# # # # # # # ..` l # # # # # # # # # # ",
|
||||
"# # # # # # # [ X ) N # # # # # # # # # ",
|
||||
"# # # # # # # [ &X. ^ F # # # # # # # # ",
|
||||
"# # # # # # # } o & o T I : # # # # # # ",
|
||||
"` ` ` ` ` ` ` ` + 7 ; + H ~ < # # # # # ",
|
||||
"` = = = = = = - @ d v h $ C ' 5 # # # # ",
|
||||
"` = = 3 u h v v v m m m v ; c { 6 # # # ",
|
||||
"` = f v v m m m m m m Z G G 4 j ..t # # ",
|
||||
"` = v m m m Z Z D D G G G P n ; _ R 5 # ",
|
||||
"` = m Z G G G G G G G P Y x 4 _ Q g # # ",
|
||||
"` = $ $ $ $ $ & e P P E k 8 .U g # # # ",
|
||||
"..[ ......[ [ ] e Y ! s i o.L p # # # # ",
|
||||
"# # 5 6 6 6 9 ..i ( i z o.S t # # # # # ",
|
||||
"# # # # # # # } i i V O.A r # # # # # # ",
|
||||
"# # # # # # # } 7 J X.M 6 # # # # # # # ",
|
||||
"# # # # # # # | W ' b < # # # # # # # # ",
|
||||
"# # # # # # # @.~ g , # # # # # # # # # ",
|
||||
"# # # # # # # 6 < , # # # # # # # # # # "
|
||||
};
|
||||
Reference in New Issue
Block a user