|
| cBigUnsigned () |
|
| cBigUnsigned (const cBigUnsigned &x) |
|
| cBigUnsigned (BIT_ENUM_t nBits, BLOCK_t uValMask) |
|
| cBigUnsigned (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
|
| cBigUnsigned (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks, bool bStatic) |
|
| cBigUnsigned (const char *pszStr, RADIX_t nBaseRadix=10) |
|
| ~cBigUnsigned () |
|
| cBigUnsigned (UINTMAX_t x) |
|
| cBigUnsigned (INTMAX_t x) |
|
| cBigUnsigned (UINT32 x) |
|
| cBigUnsigned (INT32 x) |
|
void | SetBlockSizeInit (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
|
bool | isZero () const |
|
bool | isOdd () const |
|
template<typename TYPE > |
TYPE | get_ValU () const |
|
template<typename TYPE > |
TYPE | get_ValUC () const |
|
template<typename TYPE > |
TYPE | get_ValS () const |
|
template<typename TYPE > |
TYPE | get_Val () const |
|
COMPARE_t | CompareU (BLOCK_t x) const |
| Compare against primitive type for speed. More...
|
|
bool | operator== (BLOCK_t x) const |
|
bool | operator!= (BLOCK_t x) const |
|
bool | operator< (BLOCK_t x) const |
|
bool | operator<= (BLOCK_t x) const |
|
bool | operator>= (BLOCK_t x) const |
|
bool | operator> (BLOCK_t x) const |
|
COMPARE_t | Compare (const cBigUnsigned &x) const |
| Compares this to x like Perl's <=> More...
|
|
bool | operator== (const cBigUnsigned &x) const |
|
bool | operator!= (const cBigUnsigned &x) const |
|
bool | operator< (const cBigUnsigned &x) const |
|
bool | operator<= (const cBigUnsigned &x) const |
|
bool | operator>= (const cBigUnsigned &x) const |
|
bool | operator> (const cBigUnsigned &x) const |
|
StrLen_t | GetStr (char *pszOut, StrLen_t iOutMax, RADIX_t nBaseRadix=10) const |
|
cString | GetStr (RADIX_t nBaseRadix=10) const |
|
bool | SetStr (const char *pszVal, RADIX_t nBaseRadix=10, const char **ppszEnd=(const char **) nullptr) |
|
void | put_ValU (UINTMAX_t n) |
|
HRESULT | put_ValS (INTMAX_t n) |
|
template<typename TYPE > |
void | put_Val (TYPE n) |
|
void | InitBitAnd (const cBigUnsigned &a, const cBigUnsigned &b) |
|
void | InitBitOr (const cBigUnsigned &a, const cBigUnsigned &b) |
|
void | InitBitXor (const cBigUnsigned &a, const cBigUnsigned &b) |
|
HRESULT | InitBitShiftLeft (const cBigUnsigned &a, int b) |
|
HRESULT | InitBitShiftRight (const cBigUnsigned &a, int b) |
|
void | OpBitShiftLeft1 (BLOCK_t nBitMask=0) |
|
HRESULT | OpBitShiftLeft (BIT_ENUM_t b) |
|
HRESULT | OpBitShiftRight (BIT_ENUM_t b) |
|
void | OpAdd1 (BLOCK_t nVal) |
|
HRESULT | OpSubtract1 (BLOCK_t nVal) |
|
void | InitSubtract1 (const THIS_t &a, BLOCK_t n) |
|
void | InitAdd (const cBigUnsigned &a, const cBigUnsigned &b) |
|
HRESULT | InitSubtract (const cBigUnsigned &a, const cBigUnsigned &b) |
|
HRESULT | OpSubtract (const THIS_t &b) |
|
void | InitMultiply1 (const cBigUnsigned &a, BLOCK_t b) |
|
void | InitMultiplyH (const cBigUnsigned &a, BLOCKH_t b) |
|
void | InitMultiply (const cBigUnsigned &a, const cBigUnsigned &b) |
|
BLOCK_t | GetModulusH (BLOCKH_t b) const |
|
BLOCKH_t | InitDivideH (const cBigUnsigned &a, BLOCKH_t b) |
|
HRESULT | InitDivide (const cBigUnsigned &a, const cBigUnsigned &b, OUT cBigUnsigned &remainder) |
|
HRESULT | InitDivide (const THIS_t &a, const THIS_t &b) |
|
HRESULT | InitModulus (const THIS_t &a, const THIS_t &b) |
|
HRESULT | InitModInv (const cBigUnsigned &A, const cBigUnsigned &N) |
|
HRESULT | SetRandomBits2 (BIT_ENUM_t nBits, IRandomNoise *pRandom=nullptr) |
|
HRESULT | SetRandomBits (BIT_ENUM_t nBits, IRandomNoise *pRandom=nullptr) |
|
BLOCK_t | get_MontgomeryInit () const |
|
void | SetMontMul (THIS_t &rDst, const THIS_t &B, const THIS_t &N, BLOCK_t mm) |
|
void | SetMontRedux (THIS_t &rDst, const THIS_t &N, BLOCK_t mm) |
|
void | SetPower (const THIS_t &base, const THIS_t &exponent) |
|
HRESULT | SetPowerMod (const THIS_t &base, const THIS_t &exponent, const THIS_t &modulus, OUT THIS_t *pRR=nullptr) |
|
BITOP_TYPE | TestPrimeSmall () const |
|
HRESULT | TestPrimeMiller (IRandomNoise *pRandom=nullptr) const |
|
HRESULT | TestPrimeFermat (IRandomNoise *pRandom=nullptr) const |
|
HRESULT | TestPrime (IRandomNoise *pRandom=nullptr) const |
|
HRESULT | SetPrimePrev (IRandomNoise *pRandom=nullptr, cThreadState *pCancel=nullptr) |
|
HRESULT | SetPrimeBits (BIT_ENUM_t nBits, IRandomNoise *pRandom=nullptr, cThreadState *pCancel=nullptr) |
|
HRESULT | SetPrimeBitsDH (BIT_ENUM_t nbits, IRandomNoise *pRandom=nullptr, cThreadState *pCancel=nullptr) |
|
cBigUnsigned | operator+ (const THIS_t &x) const |
| Overloaded return-by-value operators. More...
|
|
cBigUnsigned | operator+ (BLOCK_t x) const |
|
cBigUnsigned | operator- (const THIS_t &x) const |
|
cBigUnsigned | operator- (BLOCK_t x) const |
|
cBigUnsigned | operator* (const THIS_t &x) const |
|
cBigUnsigned | operator* (BLOCKH_t x) const |
|
cBigUnsigned | operator/ (const THIS_t &x) const |
|
cBigUnsigned | operator/ (BLOCKH_t n) const |
|
cBigUnsigned | operator% (const THIS_t &x) const |
|
BLOCKH_t | operator% (BLOCKH_t n) const |
|
cBigUnsigned | operator& (const THIS_t &x) const |
|
cBigUnsigned | operator| (const THIS_t &x) const |
|
cBigUnsigned | operator^ (const THIS_t &x) const |
|
cBigUnsigned | operator<< (int b) const |
|
cBigUnsigned | operator>> (int b) const |
|
void | operator+= (const THIS_t &x) |
|
void | operator+= (BLOCK_t x) |
|
void | operator-= (const THIS_t &x) |
|
void | operator-= (BLOCK_t x) |
|
void | operator*= (const THIS_t &x) |
|
void | operator*= (BLOCKH_t x) |
|
void | operator/= (const THIS_t &x) |
|
void | operator/= (BLOCKH_t n) |
|
void | operator%= (const THIS_t &x) |
|
void | operator%= (BLOCKH_t n) |
|
void | operator&= (const THIS_t &x) |
|
void | operator|= (const THIS_t &x) |
|
void | operator^= (const THIS_t &x) |
|
void | operator<<= (int b) |
|
void | operator>>= (int b) |
|
void | operator++ () |
|
void | operator++ (int) |
|
void | operator-- () |
|
void | operator-- (int) |
|
| UNITTEST_FRIEND (cBigUnsigned) |
|
template<> |
long | get_Val () const |
| overloads to get signed value correctly. More...
|
|
template<> |
void | put_Val (long n) |
|
template<> |
void | put_Val (int n) |
|
template<> |
void | put_Val (short n) |
|
bool | isHighBlockUseExact () const |
|
bool | isHighBlockUseValid () const |
|
BLOCK_ENUM_t | get_BlocksUse () const |
|
void | UpdateBlocksUse () |
|
void | UpdateBlocksUseMax (BLOCK_ENUM_t nBlocksUseMax) |
|
void | UpdateBlocksUseCap () |
|
BLOCK_t & | RefBlock (BLOCK_ENUM_t nBlock) |
|
| cBitArray () |
|
| cBitArray (BIT_ENUM_t nBits) |
|
| cBitArray (BIT_ENUM_t nBits, BLOCK_t uValueMask) |
|
| cBitArray (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
|
| cBitArray (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks, bool bStatic) |
|
| ~cBitArray () |
|
void | SetBlocksStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
|
void | SetBlocksStatic (const cBitArrayStatic &b) |
|
HRESULT | SetBlockSizeGrow (BLOCK_ENUM_t nBlocksNew) |
|
HRESULT | SetBlockSizeShrink (BLOCK_ENUM_t nBlocksNew) |
|
void | SetBlockSizeUse (BLOCK_ENUM_t nBlocksNew) |
|
bool | IsEqual (const THIS_t &x) const |
|
bool | IsEqualU (BLOCK_t x) const |
|
bool | operator== (const THIS_t &x) const |
|
bool | operator!= (const THIS_t &x) const |
|
bool | isEmptyBits () const |
|
bool | IsSet (BIT_ENUM_t nBit) const |
|
BIT_ENUM_t | get_Lowest1Bit () const |
|
BIT_ENUM_t | get_Highest1Bit () const |
|
BIT_ENUM_t | get_Count1Bits () const |
|
void | SetBit (BIT_ENUM_t nBit) |
|
void | ClrBit (BIT_ENUM_t nBit) |
|
void | ModBit (BIT_ENUM_t nBit, bool bVal) |
|
void | SetTruncateBits (BIT_ENUM_t nBits) |
|
HRESULT | SetRandomBits (BIT_ENUM_t nBits, IRandomNoise *pRandom=nullptr) |
|
HRESULT | SetRandomBitsLarge (BIT_ENUM_t nBits, IRandomNoise *pRandom=nullptr) |
|
void | SetCopyBits (const THIS_t &ref) |
|
HRESULT | SetCopySecure (const THIS_t &val, bool assign) |
|
void | SetZeroAll () |
|
void | SetNullVal () |
|
size_t | get_BinarySize () const |
|
HRESULT | GetBinaryBE (BYTE *pOut, size_t nSizeOut) const |
|
HRESULT | GetBinaryBE (cHeapBlock &b) const |
|
HRESULT | SetBinaryBE (const BYTE *pData, size_t nSize) |
|
HRESULT | SetBinaryLE (const BYTE *pData, size_t nSize) |
|
| UNITTEST_FRIEND (cBitArray) |
|
| cBitArrayStatic () noexcept |
|
| cBitArrayStatic (BIT_ENUM_t nBits) |
|
| cBitArrayStatic (BIT_ENUM_t nBits, BLOCK_t uValueMask) |
|
| cBitArrayStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pData) |
|
| cBitArrayStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocksInit, bool bStatic) |
|
| cBitArrayStatic (const THIS_t &ref) |
|
| cBitArrayStatic (THIS_t &&ref) noexcept |
|
| ~cBitArrayStatic () |
|
bool | isNullVal () const noexcept |
|
bool | isZeroVal () const noexcept |
|
BLOCK_ENUM_t | get_BlocksCap () const noexcept |
|
size_t | get_BytesCap () const noexcept |
|
BLOCK_t | GetBlockInt (BLOCK_ENUM_t i) const |
|
const BLOCK_t * | get_BlockPtrC () const noexcept |
|
BLOCK_t * | get_BlockPtr () |
|
BLOCK_t & | RefBlockInt (BLOCK_ENUM_t i) |
|
UINT32 | GetU32Int (BLOCK_ENUM_t j) const |
|
void | SetU32Int (BLOCK_ENUM_t j, UINT32 val32) |
|
const THIS_t & | operator= (const THIS_t &ref) |
|
THIS_t & | operator= (THIS_t &&ref) |
|
bool | isStatic () const noexcept |
|
void | SetBlocksStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
|
bool | isReadOnly () const noexcept |
|
BIT_ENUM_t | get_BitsCap () const noexcept |
|
bool | IsValidBit (BIT_ENUM_t nBit) const noexcept |
|
bool | IsSet (BIT_ENUM_t nBit) const |
|
bool | isOdd () const |
|
void | ClrBit (BIT_ENUM_t nBit) |
|
void | SetBit (BIT_ENUM_t nBit) |
|
bool | SetBitRet (BIT_ENUM_t nBit) |
|
void | ModBit (BIT_ENUM_t nBit, bool bVal) |
|
void | SetNullVal () noexcept |
|
void | SetZeroAll () |
|
void | SetAll1 () |
|
void | SetBitsSizeZ (BIT_ENUM_t nBits) |
|
void | SetInvertBytes (size_t nSize) |
|
void | SetCopyBits (const THIS_t &ref) |
|
|
static void | MultiplyHelper (BLOCK_t *pDst, BLOCK_ENUM_t nBlocks, const cBigUnsigned &rSrc, BLOCK_t nMult) |
|
static void GRAYCALL | EuclideanAlgorithm (const cBigUnsigned &x, const cBigUnsigned &y, OUT cBigUnsigned &a, OUT cBigUnsigned &b, OUT cBigUnsigned &g) |
|
static cBigUnsigned GRAYCALL | GetGreatestCommonDivisor (const cBigUnsigned &x, const cBigUnsigned &y) |
|
static HRESULT GRAYCALL | ReturnError (HRESULT hRes, const char *pszMsg) |
|
static HRESULT GRAYCALL | SwapSecure (THIS_t &X, THIS_t &Y, bool swap) |
|
static BLOCK_ENUM_t | GetBlocksFromBits (BIT_ENUM_t nBits) noexcept |
|
static BLOCK_ENUM_t | GetBlocksFromBytes (size_t nBytes) noexcept |
|
static bool | IsReasonableBlockQty (BLOCK_ENUM_t nBlocks) noexcept |
|
static constexpr size_t | GetSizeBytes (BIT_ENUM_t nBits) noexcept |
|
template<typename TYPE > |
static constexpr TYPE | Mask1 (BIT_ENUM_t nBit) noexcept |
|
template<typename TYPE > |
static constexpr bool | IsMask1 (TYPE nVal) noexcept |
|
template<typename TYPE > |
static constexpr bool | IsSet (TYPE nVal, BIT_ENUM_t nBit) noexcept |
|
template<typename TYPE > |
static constexpr bool | IsClear (TYPE nVal, BIT_ENUM_t nBit) noexcept |
|
template<typename TYPE > |
static constexpr TYPE | SetBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
|
template<typename TYPE > |
static constexpr TYPE | ClearBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
|
template<typename TYPE > |
static constexpr bool | HasMask (TYPE nVal, TYPE nMask) noexcept |
|
template<typename TYPE > |
static BIT_ENUM_t | Highest1Bit (TYPE nMask) noexcept |
|
template<typename TYPE > |
static BIT_ENUM_t | Count1Bits (TYPE nMask) noexcept |
|
template<typename TYPE > |
static TYPE | Rotl (TYPE nVal, BIT_ENUM_t nBits) noexcept |
|
template<typename TYPE > |
static TYPE | Rotr (TYPE nVal, BIT_ENUM_t nBits) noexcept |
|
template<typename TYPE > |
static TYPE | Reverse (TYPE nVal) noexcept |
|
template<> |
BIT_ENUM_t | Count1Bits (UINT32 nVal) noexcept |
|
template<> |
BYTE | Reverse (BYTE nVal) noexcept |
|
template<> |
UINT32 | Reverse (UINT32 nVal) noexcept |
|
template<> |
ULONG | Reverse (ULONG nVal) noexcept |
|
An arbitrarily large unsigned number. limited only by memory. Stored as little endian order blocks. Can be used to hold a RSA key or other large number. Often used for a prime number.
- Note
- DON'T ASSUME BLOCK_t is USE_LITTLE_ENDIAN native format. Beware of type punning to BLOCKH_t. Can throw: Overflow (also if signed), Divide By Zero, etc. Check out sample: http://cpp-bigint.sourceforge.net/ or http://dclib.sourceforge.net/