|
@@ -1,4 +1,5 @@
|
|
|
-// ECOin - Copyright (c) - 2014/2021 - GPLv3 - epsylon@riseup.net (https://03c8.net)
|
|
|
+// ECOin - Copyright (c) - 2014/2022 - GPLv3 - epsylon@riseup.net (https://03c8.net)
|
|
|
+
|
|
|
#ifndef ECOIN_BIGNUM_H
|
|
|
#define ECOIN_BIGNUM_H
|
|
|
|
|
@@ -45,52 +46,65 @@ public:
|
|
|
|
|
|
|
|
|
/** C++ wrapper for BIGNUM (OpenSSL bignum) */
|
|
|
-class CBigNum : public BIGNUM
|
|
|
+class CBigNum
|
|
|
{
|
|
|
+
|
|
|
+protected:
|
|
|
+ BIGNUM *bn;
|
|
|
+
|
|
|
+ void init()
|
|
|
+ {
|
|
|
+ bn = BN_new();
|
|
|
+ }
|
|
|
+
|
|
|
public:
|
|
|
CBigNum()
|
|
|
{
|
|
|
- BN_init(this);
|
|
|
+ init();
|
|
|
}
|
|
|
|
|
|
CBigNum(const CBigNum& b)
|
|
|
{
|
|
|
- BN_init(this);
|
|
|
- if (!BN_copy(this, &b))
|
|
|
+ init();
|
|
|
+ if (!BN_copy(bn, &b))
|
|
|
{
|
|
|
- BN_clear_free(this);
|
|
|
+ BN_clear_free(bn);
|
|
|
throw bignum_error("CBigNum::CBigNum(const CBigNum&) : BN_copy failed");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
CBigNum& operator=(const CBigNum& b)
|
|
|
{
|
|
|
- if (!BN_copy(this, &b))
|
|
|
+ if (!BN_copy(bn, &b))
|
|
|
throw bignum_error("CBigNum::operator= : BN_copy failed");
|
|
|
return (*this);
|
|
|
}
|
|
|
|
|
|
~CBigNum()
|
|
|
{
|
|
|
- BN_clear_free(this);
|
|
|
+ BN_clear_free(bn);
|
|
|
}
|
|
|
|
|
|
- //CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'.
|
|
|
- CBigNum(signed 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); }
|
|
|
+ BIGNUM *operator &() const
|
|
|
+ {
|
|
|
+ return bn;
|
|
|
+ }
|
|
|
|
|
|
+ //CBigNum(char n) is not portable. Use 'signed char' or 'unsigned char'.
|
|
|
+ CBigNum(signed char n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
|
|
+ CBigNum(short n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
|
|
+ CBigNum(int n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
|
|
+ CBigNum(long n) { init(); if (n >= 0) setulong(n); else setint64(n); }
|
|
|
+ CBigNum(int64 n) { init(); setint64(n); }
|
|
|
+ CBigNum(unsigned char n) { init(); setulong(n); }
|
|
|
+ CBigNum(unsigned short n) { init(); setulong(n); }
|
|
|
+ CBigNum(unsigned int n) { init(); setulong(n); }
|
|
|
+ CBigNum(unsigned long n) { init(); setulong(n); }
|
|
|
+ CBigNum(uint64 n) { init(); setuint64(n); }
|
|
|
+ explicit CBigNum(uint256 n) { init(); setuint256(n); }
|
|
|
explicit CBigNum(const std::vector<unsigned char>& vch)
|
|
|
{
|
|
|
- BN_init(this);
|
|
|
+ init();
|
|
|
setvch(vch);
|
|
|
}
|
|
|
|
|
@@ -124,43 +138,43 @@ public:
|
|
|
* @return the size
|
|
|
*/
|
|
|
int bitSize() const{
|
|
|
- return BN_num_bits(this);
|
|
|
+ return BN_num_bits(bn);
|
|
|
}
|
|
|
|
|
|
|
|
|
void setulong(unsigned long n)
|
|
|
{
|
|
|
- if (!BN_set_word(this, n))
|
|
|
+ if (!BN_set_word(bn, n))
|
|
|
throw bignum_error("CBigNum conversion from unsigned long : BN_set_word failed");
|
|
|
}
|
|
|
|
|
|
unsigned long getulong() const
|
|
|
{
|
|
|
- return BN_get_word(this);
|
|
|
+ return BN_get_word(bn);
|
|
|
}
|
|
|
|
|
|
unsigned int getuint() const
|
|
|
{
|
|
|
- return BN_get_word(this);
|
|
|
+ return BN_get_word(bn);
|
|
|
}
|
|
|
|
|
|
int getint() const
|
|
|
{
|
|
|
- unsigned long n = BN_get_word(this);
|
|
|
- if (!BN_is_negative(this))
|
|
|
+ unsigned long n = BN_get_word(bn);
|
|
|
+ if (!BN_is_negative(bn))
|
|
|
return (n > (unsigned long)std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
|
|
|
else
|
|
|
return (n > (unsigned long)std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
|
|
|
}
|
|
|
|
|
|
- void setint64(int64 sn)
|
|
|
+ void setint64(int64_t sn)
|
|
|
{
|
|
|
unsigned char pch[sizeof(sn) + 6];
|
|
|
unsigned char* p = pch + 4;
|
|
|
bool fNegative;
|
|
|
- uint64 n;
|
|
|
+ uint64_t n;
|
|
|
|
|
|
- if (sn < (int64)0)
|
|
|
+ if (sn < (int64_t)0)
|
|
|
{
|
|
|
// Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate
|
|
|
n = -(sn + 1);
|
|
@@ -193,16 +207,16 @@ public:
|
|
|
pch[1] = (nSize >> 16) & 0xff;
|
|
|
pch[2] = (nSize >> 8) & 0xff;
|
|
|
pch[3] = (nSize) & 0xff;
|
|
|
- BN_mpi2bn(pch, p - pch, this);
|
|
|
+ BN_mpi2bn(pch, p - pch, bn);
|
|
|
}
|
|
|
|
|
|
uint64 getuint64()
|
|
|
{
|
|
|
- unsigned int nSize = BN_bn2mpi(this, NULL);
|
|
|
+ unsigned int nSize = BN_bn2mpi(bn, NULL);
|
|
|
if (nSize < 4)
|
|
|
return 0;
|
|
|
std::vector<unsigned char> vch(nSize);
|
|
|
- BN_bn2mpi(this, &vch[0]);
|
|
|
+ BN_bn2mpi(bn, &vch[0]);
|
|
|
if (vch.size() > 4)
|
|
|
vch[4] &= 0x7f;
|
|
|
uint64 n = 0;
|
|
@@ -211,7 +225,7 @@ public:
|
|
|
return n;
|
|
|
}
|
|
|
|
|
|
- void setuint64(uint64 n)
|
|
|
+ void setuint64(uint64_t n)
|
|
|
{
|
|
|
unsigned char pch[sizeof(n) + 6];
|
|
|
unsigned char* p = pch + 4;
|
|
@@ -235,7 +249,7 @@ public:
|
|
|
pch[1] = (nSize >> 16) & 0xff;
|
|
|
pch[2] = (nSize >> 8) & 0xff;
|
|
|
pch[3] = (nSize) & 0xff;
|
|
|
- BN_mpi2bn(pch, p - pch, this);
|
|
|
+ BN_mpi2bn(pch, p - pch, bn);
|
|
|
}
|
|
|
|
|
|
void setuint256(uint256 n)
|
|
@@ -263,16 +277,16 @@ public:
|
|
|
pch[1] = (nSize >> 16) & 0xff;
|
|
|
pch[2] = (nSize >> 8) & 0xff;
|
|
|
pch[3] = (nSize >> 0) & 0xff;
|
|
|
- BN_mpi2bn(pch, p - pch, this);
|
|
|
+ BN_mpi2bn(pch, p - pch, bn);
|
|
|
}
|
|
|
|
|
|
uint256 getuint256() const
|
|
|
{
|
|
|
- unsigned int nSize = BN_bn2mpi(this, NULL);
|
|
|
+ unsigned int nSize = BN_bn2mpi(bn, NULL);
|
|
|
if (nSize < 4)
|
|
|
return 0;
|
|
|
std::vector<unsigned char> vch(nSize);
|
|
|
- BN_bn2mpi(this, &vch[0]);
|
|
|
+ BN_bn2mpi(bn, &vch[0]);
|
|
|
if (vch.size() > 4)
|
|
|
vch[4] &= 0x7f;
|
|
|
uint256 n = 0;
|
|
@@ -281,7 +295,6 @@ public:
|
|
|
return n;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
void setvch(const std::vector<unsigned char>& vch)
|
|
|
{
|
|
|
std::vector<unsigned char> vch2(vch.size() + 4);
|
|
@@ -294,16 +307,16 @@ public:
|
|
|
vch2[3] = (nSize >> 0) & 0xff;
|
|
|
// swap data to big endian
|
|
|
reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
|
|
|
- BN_mpi2bn(&vch2[0], vch2.size(), this);
|
|
|
+ BN_mpi2bn(&vch2[0], vch2.size(), bn);
|
|
|
}
|
|
|
|
|
|
std::vector<unsigned char> getvch() const
|
|
|
{
|
|
|
- unsigned int nSize = BN_bn2mpi(this, NULL);
|
|
|
+ unsigned int nSize = BN_bn2mpi(bn, NULL);
|
|
|
if (nSize <= 4)
|
|
|
return std::vector<unsigned char>();
|
|
|
std::vector<unsigned char> vch(nSize);
|
|
|
- BN_bn2mpi(this, &vch[0]);
|
|
|
+ BN_bn2mpi(bn, &vch[0]);
|
|
|
vch.erase(vch.begin(), vch.begin() + 4);
|
|
|
reverse(vch.begin(), vch.end());
|
|
|
return vch;
|
|
@@ -312,25 +325,57 @@ public:
|
|
|
CBigNum& SetCompact(unsigned int nCompact)
|
|
|
{
|
|
|
unsigned int nSize = nCompact >> 24;
|
|
|
- std::vector<unsigned char> vch(4 + nSize);
|
|
|
+ /** 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);
|
|
|
+ BN_mpi2bn(&vch[0], vch.size(), this);*/
|
|
|
+ bool fNegative =(nCompact & 0x00800000) != 0;
|
|
|
+ unsigned int nWord = nCompact & 0x007fffff;
|
|
|
+ if (nSize <= 3)
|
|
|
+ {
|
|
|
+ nWord >>= 8*(3-nSize);
|
|
|
+ BN_set_word(bn, nWord);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BN_set_word(bn, nWord);
|
|
|
+ BN_lshift(bn, bn, 8*(nSize-3));
|
|
|
+ }
|
|
|
+ BN_set_negative(bn, fNegative);
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
unsigned int GetCompact() const
|
|
|
{
|
|
|
- unsigned int nSize = BN_bn2mpi(this, NULL);
|
|
|
+/** 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);
|
|
|
+ if (nSize >= 3) nCompact |= (vch[6] << 0);*/
|
|
|
+ unsigned int nSize = BN_num_bytes(bn);
|
|
|
+ unsigned int nCompact = 0;
|
|
|
+ if (nSize <= 3)
|
|
|
+ nCompact = BN_get_word(bn) << 8*(3-nSize);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CBigNum bn1;
|
|
|
+ BN_rshift(&bn1, bn, 8*(nSize-3));
|
|
|
+ nCompact = BN_get_word(&bn1);
|
|
|
+ }
|
|
|
+ // The 0x00800000 bit denotes the sign.
|
|
|
+ // Thus, if it is already set, divide the mantissa by 256 and increase the exponent.
|
|
|
+ if (nCompact & 0x00800000)
|
|
|
+ {
|
|
|
+ nCompact >>= 8;
|
|
|
+ nSize++;
|
|
|
+ }
|
|
|
+ nCompact |= nSize << 24;
|
|
|
+ nCompact |= (BN_is_negative(bn) ? 0x00800000 : 0);
|
|
|
return nCompact;
|
|
|
}
|
|
|
|
|
@@ -364,27 +409,59 @@ public:
|
|
|
*this = 0 - *this;
|
|
|
}
|
|
|
|
|
|
+ bool SetHexBool(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 const signed 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[(unsigned char)*psz++];
|
|
|
+ *this += n;
|
|
|
+ }
|
|
|
+ if (fNegative)
|
|
|
+ *this = 0 - *this;
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
std::string ToString(int nBase=10) const
|
|
|
{
|
|
|
CAutoBN_CTX pctx;
|
|
|
CBigNum bnBase = nBase;
|
|
|
CBigNum bn0 = 0;
|
|
|
std::string str;
|
|
|
- CBigNum bn = *this;
|
|
|
- BN_set_negative(&bn, false);
|
|
|
+ CBigNum bn1 = *this;
|
|
|
+ BN_set_negative(&bn1, false);
|
|
|
CBigNum dv;
|
|
|
CBigNum rem;
|
|
|
- if (BN_cmp(&bn, &bn0) == 0)
|
|
|
+ if (BN_cmp(&bn1, &bn0) == 0)
|
|
|
return "0";
|
|
|
- while (BN_cmp(&bn, &bn0) > 0)
|
|
|
+ while (BN_cmp(&bn1, &bn0) > 0)
|
|
|
{
|
|
|
- if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
|
|
|
+ if (!BN_div(&dv, &rem, &bn1, &bnBase, pctx))
|
|
|
throw bignum_error("CBigNum::ToString() : BN_div failed");
|
|
|
- bn = dv;
|
|
|
+ bn1 = dv;
|
|
|
unsigned int c = rem.getulong();
|
|
|
str += "0123456789abcdef"[c];
|
|
|
}
|
|
|
- if (BN_is_negative(this))
|
|
|
+ if (BN_is_negative(bn))
|
|
|
str += "-";
|
|
|
reverse(str.begin(), str.end());
|
|
|
return str;
|
|
@@ -431,7 +508,7 @@ public:
|
|
|
CBigNum pow(const CBigNum& e) const {
|
|
|
CAutoBN_CTX pctx;
|
|
|
CBigNum ret;
|
|
|
- if (!BN_exp(&ret, this, &e, pctx))
|
|
|
+ if (!BN_exp(&ret, bn, &e, pctx))
|
|
|
throw bignum_error("CBigNum::pow : BN_exp failed");
|
|
|
return ret;
|
|
|
}
|
|
@@ -444,7 +521,7 @@ public:
|
|
|
CBigNum mul_mod(const CBigNum& b, const CBigNum& m) const {
|
|
|
CAutoBN_CTX pctx;
|
|
|
CBigNum ret;
|
|
|
- if (!BN_mod_mul(&ret, this, &b, &m, pctx))
|
|
|
+ if (!BN_mod_mul(&ret, bn, &b, &m, pctx))
|
|
|
throw bignum_error("CBigNum::mul_mod : BN_mod_mul failed");
|
|
|
|
|
|
return ret;
|
|
@@ -465,7 +542,7 @@ public:
|
|
|
if (!BN_mod_exp(&ret, &inv, &posE, &m, pctx))
|
|
|
throw bignum_error("CBigNum::pow_mod: BN_mod_exp failed on negative exponent");
|
|
|
}else
|
|
|
- if (!BN_mod_exp(&ret, this, &e, &m, pctx))
|
|
|
+ if (!BN_mod_exp(&ret, bn, &e, &m, pctx))
|
|
|
throw bignum_error("CBigNum::pow_mod : BN_mod_exp failed");
|
|
|
|
|
|
return ret;
|
|
@@ -480,7 +557,7 @@ public:
|
|
|
CBigNum inverse(const CBigNum& m) const {
|
|
|
CAutoBN_CTX pctx;
|
|
|
CBigNum ret;
|
|
|
- if (!BN_mod_inverse(&ret, this, &m, pctx))
|
|
|
+ if (!BN_mod_inverse(&ret, bn, &m, pctx))
|
|
|
throw bignum_error("CBigNum::inverse*= :BN_mod_inverse");
|
|
|
return ret;
|
|
|
}
|
|
@@ -506,7 +583,7 @@ public:
|
|
|
CBigNum gcd( const CBigNum& b) const{
|
|
|
CAutoBN_CTX pctx;
|
|
|
CBigNum ret;
|
|
|
- if (!BN_gcd(&ret, this, &b, pctx))
|
|
|
+ if (!BN_gcd(&ret, bn, &b, pctx))
|
|
|
throw bignum_error("CBigNum::gcd*= :BN_gcd");
|
|
|
return ret;
|
|
|
}
|
|
@@ -519,7 +596,7 @@ public:
|
|
|
*/
|
|
|
bool isPrime(const int checks=BN_prime_checks) const {
|
|
|
CAutoBN_CTX pctx;
|
|
|
- int ret = BN_is_prime(this, checks, NULL, pctx, NULL);
|
|
|
+ int ret = BN_is_prime_ex(bn, checks, pctx, NULL);
|
|
|
if(ret < 0){
|
|
|
throw bignum_error("CBigNum::isPrime :BN_is_prime");
|
|
|
}
|
|
@@ -527,18 +604,18 @@ public:
|
|
|
}
|
|
|
|
|
|
bool isOne() const {
|
|
|
- return BN_is_one(this);
|
|
|
+ return BN_is_one(bn);
|
|
|
}
|
|
|
|
|
|
|
|
|
bool operator!() const
|
|
|
{
|
|
|
- return BN_is_zero(this);
|
|
|
+ return BN_is_zero(bn);
|
|
|
}
|
|
|
|
|
|
CBigNum& operator+=(const CBigNum& b)
|
|
|
{
|
|
|
- if (!BN_add(this, this, &b))
|
|
|
+ if (!BN_add(bn, bn, &b))
|
|
|
throw bignum_error("CBigNum::operator+= : BN_add failed");
|
|
|
return *this;
|
|
|
}
|
|
@@ -552,7 +629,7 @@ public:
|
|
|
CBigNum& operator*=(const CBigNum& b)
|
|
|
{
|
|
|
CAutoBN_CTX pctx;
|
|
|
- if (!BN_mul(this, this, &b, pctx))
|
|
|
+ if (!BN_mul(bn, bn, &b, pctx))
|
|
|
throw bignum_error("CBigNum::operator*= : BN_mul failed");
|
|
|
return *this;
|
|
|
}
|
|
@@ -571,7 +648,7 @@ public:
|
|
|
|
|
|
CBigNum& operator<<=(unsigned int shift)
|
|
|
{
|
|
|
- if (!BN_lshift(this, this, shift))
|
|
|
+ if (!BN_lshift(bn, bn, shift))
|
|
|
throw bignum_error("CBigNum:operator<<= : BN_lshift failed");
|
|
|
return *this;
|
|
|
}
|
|
@@ -582,13 +659,13 @@ public:
|
|
|
// 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)
|
|
|
+ if (BN_cmp(&a, bn) > 0)
|
|
|
{
|
|
|
*this = 0;
|
|
|
return *this;
|
|
|
}
|
|
|
|
|
|
- if (!BN_rshift(this, this, shift))
|
|
|
+ if (!BN_rshift(bn, bn, shift))
|
|
|
throw bignum_error("CBigNum:operator>>= : BN_rshift failed");
|
|
|
return *this;
|
|
|
}
|
|
@@ -597,7 +674,7 @@ public:
|
|
|
CBigNum& operator++()
|
|
|
{
|
|
|
// prefix operator
|
|
|
- if (!BN_add(this, this, BN_value_one()))
|
|
|
+ if (!BN_add(bn, bn, BN_value_one()))
|
|
|
throw bignum_error("CBigNum::operator++ : BN_add failed");
|
|
|
return *this;
|
|
|
}
|
|
@@ -614,7 +691,7 @@ public:
|
|
|
{
|
|
|
// prefix operator
|
|
|
CBigNum r;
|
|
|
- if (!BN_sub(&r, this, BN_value_one()))
|
|
|
+ if (!BN_sub(&r, bn, BN_value_one()))
|
|
|
throw bignum_error("CBigNum::operator-- : BN_sub failed");
|
|
|
*this = r;
|
|
|
return *this;
|
|
@@ -709,9 +786,8 @@ inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a,
|
|
|
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 std::ostream& operator<<(std::ostream &strm, const CBigNum &b) { return strm << b.ToString(10); }
|
|
|
|
|
|
-typedef CBigNum Bignum;
|
|
|
+//typedef CBigNum Bignum;
|
|
|
|
|
|
#endif
|