Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Int< PRECISION > Union Template Reference

#include <INT.H>

Public Member Functions

 Int (void)
 
 Int (unsigned long value)
 
void Randomize (Straw &rng, int bitcount)
 
void Randomize (Straw &rng, const Int &minval, const Int &maxval)
 
 operator digit * ()
 
 operator const digit * () const
 
bool operator[] (unsigned bit) const
 
Int & operator++ (void)
 
Int & operator-- (void)
 
int operator! (void) const
 
Int operator~ (void)
 
Int operator- (void) const
 
int ByteCount (void) const
 
int BitCount (void) const
 
bool Is_Negative (void) const
 
unsigned MaxBitPrecision () const
 
bool IsSmallPrime (void) const
 
bool SmallDivisorsTest (void) const
 
bool FermatTest (unsigned rounds) const
 
bool IsPrime (void) const
 
bool RabinMillerTest (Straw &rng, unsigned int rounds) const
 
Int & operator+= (const Int &number)
 
Int & operator-= (const Int &number)
 
Int & operator*= (const Int &multiplier)
 
Int & operator/= (const Int &t)
 
Int & operator%= (const Int &t)
 
Int & operator<<= (int bits)
 
Int & operator>>= (int bits)
 
Int operator+ (const Int &number) const
 
Int operator+ (unsigned short b) const
 
Int operator- (const Int &number) const
 
Int operator- (unsigned short b) const
 
Int operator* (const Int &multiplier) const
 
Int operator* (unsigned short b) const
 
Int operator/ (const Int &divisor) const
 
Int operator/ (unsigned long b) const
 
Int operator/ (unsigned short divisor) const
 
Int operator% (const Int &divisor) const
 
Int operator% (unsigned long b) const
 
unsigned short operator% (unsigned short divisor) const
 
Int operator>> (int bits) const
 
Int operator<< (int bits) const
 
int operator== (const Int &b) const
 
int operator!= (const Int &b) const
 
int operator> (const Int &number) const
 
int operator>= (const Int &number) const
 
int operator< (const Int &number) const
 
int operator<= (const Int &number) const
 
void Negate (void)
 
Int Abs (void)
 
Int exp_b_mod_c (const Int &e, const Int &m) const
 
void Set_Bit (int index)
 
Int Inverse (const Int &modulus) const
 
int Encode (unsigned char *output) const
 
int Encode (unsigned char *output, unsigned length) const
 
void Signed_Decode (const unsigned char *from, int frombytes)
 
void Unsigned_Decode (const unsigned char *from, int frombytes)
 
int DEREncode (unsigned char *output) const
 
void DERDecode (const unsigned char *input)
 

Static Public Member Functions

static Int Unsigned_Mult (Int const &multiplicand, Int const &multiplier)
 
static void Unsigned_Divide (Int &remainder, Int &quotient, const Int &dividend, const Int &divisor)
 
static void Signed_Divide (Int &remainder, Int &quotient, const Int &dividend, const Int &divisor)
 
static Int Decode_ASCII (char const *string)
 

Public Attributes

unsigned long Long
 
struct { 
 
   unsigned char   C3 
 
   unsigned char   C2 
 
   unsigned char   C1 
 
   unsigned char   C0 
 
} Char 
 
digit reg [PRECISION]
 
struct { 
 
   unsigned char   C3 
 
   unsigned char   C2 
 
   unsigned char   C1 
 
   unsigned char   C0 
 
} Char 
 

Static Public Attributes

static int Error
 
static bool Carry
 
static bool Borrow
 
static Int Remainder
 

Friends

struct RemainderTable< Int< PRECISION > >
 
Int< PRECISION > Gcd FN_TEMPLATE (const Int< PRECISION > &, const Int< PRECISION > &)
 

Detailed Description

template<int PRECISION>
union Int< PRECISION >

Definition at line 55 of file blowfish.cpp.

Constructor & Destructor Documentation

◆ Int() [1/2]

template<int PRECISION>
Int< PRECISION >::Int ( void )
inline

Definition at line 69 of file INT.H.

◆ Int() [2/2]

template<int PRECISION>
Int< PRECISION >::Int ( unsigned long value)
inline

Definition at line 70 of file INT.H.

Member Function Documentation

◆ Abs()

template<int PRECISION>
Int Int< PRECISION >::Abs ( void )
inline

Definition at line 157 of file INT.H.

◆ BitCount()

template<int PRECISION>
int Int< PRECISION >::BitCount ( void ) const
inline

Definition at line 101 of file INT.H.

◆ ByteCount()

template<int PRECISION>
int Int< PRECISION >::ByteCount ( void ) const
inline

Definition at line 100 of file INT.H.

◆ Decode_ASCII()

template<int PRECISION>
static Int Int< PRECISION >::Decode_ASCII ( char const * string)
inlinestatic

Definition at line 171 of file INT.H.

◆ DERDecode()

template<int PRECISION>
void Int< PRECISION >::DERDecode ( const unsigned char * input)
inline

Definition at line 181 of file INT.H.

◆ DEREncode()

template<int PRECISION>
int Int< PRECISION >::DEREncode ( unsigned char * output) const
inline

Definition at line 180 of file INT.H.

◆ Encode() [1/2]

template<int PRECISION>
int Int< PRECISION >::Encode ( unsigned char * output) const
inline

Definition at line 174 of file INT.H.

◆ Encode() [2/2]

template<int PRECISION>
int Int< PRECISION >::Encode ( unsigned char * output,
unsigned length ) const
inline

Definition at line 175 of file INT.H.

◆ exp_b_mod_c()

template<int PRECISION>
Int Int< PRECISION >::exp_b_mod_c ( const Int< PRECISION > & e,
const Int< PRECISION > & m ) const
inline

Definition at line 159 of file INT.H.

◆ FermatTest()

template<int PRECISION>
bool Int< PRECISION >::FermatTest ( unsigned rounds) const
inline

Definition at line 106 of file INT.H.

◆ Inverse()

template<int PRECISION>
Int Int< PRECISION >::Inverse ( const Int< PRECISION > & modulus) const
inline

Definition at line 169 of file INT.H.

◆ Is_Negative()

template<int PRECISION>
bool Int< PRECISION >::Is_Negative ( void ) const
inline

Definition at line 102 of file INT.H.

◆ IsPrime()

template<int PRECISION>
bool Int< PRECISION >::IsPrime ( void ) const
inline

Definition at line 107 of file INT.H.

◆ IsSmallPrime()

template<int PRECISION>
bool Int< PRECISION >::IsSmallPrime ( void ) const
inline

Definition at line 104 of file INT.H.

◆ MaxBitPrecision()

template<int PRECISION>
unsigned Int< PRECISION >::MaxBitPrecision ( ) const
inline

Definition at line 103 of file INT.H.

◆ Negate()

template<int PRECISION>
void Int< PRECISION >::Negate ( void )
inline

Definition at line 156 of file INT.H.

◆ operator const digit *()

template<int PRECISION>
Int< PRECISION >::operator const digit * ( ) const
inline

Definition at line 81 of file INT.H.

◆ operator digit *()

template<int PRECISION>
Int< PRECISION >::operator digit * ( )
inline

Definition at line 80 of file INT.H.

◆ operator!()

template<int PRECISION>
int Int< PRECISION >::operator! ( void ) const
inline

Definition at line 93 of file INT.H.

◆ operator!=()

template<int PRECISION>
int Int< PRECISION >::operator!= ( const Int< PRECISION > & b) const
inline

Definition at line 147 of file INT.H.

◆ operator%() [1/3]

template<int PRECISION>
Int Int< PRECISION >::operator% ( const Int< PRECISION > & divisor) const
inline

Definition at line 133 of file INT.H.

◆ operator%() [2/3]

template<int PRECISION>
Int Int< PRECISION >::operator% ( unsigned long b) const
inline

Definition at line 134 of file INT.H.

◆ operator%() [3/3]

template<int PRECISION>
unsigned short Int< PRECISION >::operator% ( unsigned short divisor) const
inline

Definition at line 135 of file INT.H.

◆ operator%=()

template<int PRECISION>
Int & Int< PRECISION >::operator%= ( const Int< PRECISION > & t)
inline

Definition at line 117 of file INT.H.

◆ operator*() [1/2]

template<int PRECISION>
Int Int< PRECISION >::operator* ( const Int< PRECISION > & multiplier) const
inline

Definition at line 128 of file INT.H.

◆ operator*() [2/2]

template<int PRECISION>
Int Int< PRECISION >::operator* ( unsigned short b) const
inline

Definition at line 129 of file INT.H.

◆ operator*=()

template<int PRECISION>
Int & Int< PRECISION >::operator*= ( const Int< PRECISION > & multiplier)
inline

Definition at line 115 of file INT.H.

◆ operator+() [1/2]

template<int PRECISION>
Int Int< PRECISION >::operator+ ( const Int< PRECISION > & number) const
inline

Definition at line 124 of file INT.H.

◆ operator+() [2/2]

template<int PRECISION>
Int Int< PRECISION >::operator+ ( unsigned short b) const
inline

Definition at line 125 of file INT.H.

◆ operator++()

template<int PRECISION>
Int & Int< PRECISION >::operator++ ( void )
inline

Definition at line 91 of file INT.H.

◆ operator+=()

template<int PRECISION>
Int & Int< PRECISION >::operator+= ( const Int< PRECISION > & number)
inline

Definition at line 113 of file INT.H.

◆ operator-() [1/3]

template<int PRECISION>
Int Int< PRECISION >::operator- ( const Int< PRECISION > & number) const
inline

Definition at line 126 of file INT.H.

◆ operator-() [2/3]

template<int PRECISION>
Int Int< PRECISION >::operator- ( unsigned short b) const
inline

Definition at line 127 of file INT.H.

◆ operator-() [3/3]

template<int PRECISION>
Int Int< PRECISION >::operator- ( void ) const
inline

Definition at line 95 of file INT.H.

◆ operator--()

template<int PRECISION>
Int & Int< PRECISION >::operator-- ( void )
inline

Definition at line 92 of file INT.H.

◆ operator-=()

template<int PRECISION>
Int & Int< PRECISION >::operator-= ( const Int< PRECISION > & number)
inline

Definition at line 114 of file INT.H.

◆ operator/() [1/3]

template<int PRECISION>
Int Int< PRECISION >::operator/ ( const Int< PRECISION > & divisor) const
inline

Definition at line 130 of file INT.H.

◆ operator/() [2/3]

template<int PRECISION>
Int Int< PRECISION >::operator/ ( unsigned long b) const
inline

Definition at line 131 of file INT.H.

◆ operator/() [3/3]

template<int PRECISION>
Int Int< PRECISION >::operator/ ( unsigned short divisor) const
inline

Definition at line 132 of file INT.H.

◆ operator/=()

template<int PRECISION>
Int & Int< PRECISION >::operator/= ( const Int< PRECISION > & t)
inline

Definition at line 116 of file INT.H.

◆ operator<()

template<int PRECISION>
int Int< PRECISION >::operator< ( const Int< PRECISION > & number) const
inline

Definition at line 150 of file INT.H.

◆ operator<<()

template<int PRECISION>
Int Int< PRECISION >::operator<< ( int bits) const
inline

Definition at line 141 of file INT.H.

◆ operator<<=()

template<int PRECISION>
Int & Int< PRECISION >::operator<<= ( int bits)
inline

Definition at line 118 of file INT.H.

◆ operator<=()

template<int PRECISION>
int Int< PRECISION >::operator<= ( const Int< PRECISION > & number) const
inline

Definition at line 151 of file INT.H.

◆ operator==()

template<int PRECISION>
int Int< PRECISION >::operator== ( const Int< PRECISION > & b) const
inline

Definition at line 146 of file INT.H.

◆ operator>()

template<int PRECISION>
int Int< PRECISION >::operator> ( const Int< PRECISION > & number) const
inline

Definition at line 148 of file INT.H.

◆ operator>=()

template<int PRECISION>
int Int< PRECISION >::operator>= ( const Int< PRECISION > & number) const
inline

Definition at line 149 of file INT.H.

◆ operator>>()

template<int PRECISION>
Int Int< PRECISION >::operator>> ( int bits) const
inline

Definition at line 140 of file INT.H.

◆ operator>>=()

template<int PRECISION>
Int & Int< PRECISION >::operator>>= ( int bits)
inline

Definition at line 119 of file INT.H.

◆ operator[]()

template<int PRECISION>
bool Int< PRECISION >::operator[] ( unsigned bit) const
inline

Definition at line 86 of file INT.H.

◆ operator~()

template<int PRECISION>
Int Int< PRECISION >::operator~ ( void )
inline

Definition at line 94 of file INT.H.

◆ RabinMillerTest()

template<int PRECISION>
bool Int< PRECISION >::RabinMillerTest ( Straw & rng,
unsigned int rounds ) const
inline

Definition at line 108 of file INT.H.

◆ Randomize() [1/2]

template<int PRECISION>
void Int< PRECISION >::Randomize ( Straw & rng,
const Int< PRECISION > & minval,
const Int< PRECISION > & maxval )
inline

Definition at line 73 of file INT.H.

◆ Randomize() [2/2]

template<int PRECISION>
void Int< PRECISION >::Randomize ( Straw & rng,
int bitcount )
inline

Definition at line 72 of file INT.H.

◆ Set_Bit()

template<int PRECISION>
void Int< PRECISION >::Set_Bit ( int index)
inline

Definition at line 165 of file INT.H.

◆ Signed_Decode()

template<int PRECISION>
void Int< PRECISION >::Signed_Decode ( const unsigned char * from,
int frombytes )
inline

Definition at line 176 of file INT.H.

◆ Signed_Divide()

template<int PRECISION>
static void Int< PRECISION >::Signed_Divide ( Int< PRECISION > & remainder,
Int< PRECISION > & quotient,
const Int< PRECISION > & dividend,
const Int< PRECISION > & divisor )
inlinestatic

Definition at line 168 of file INT.H.

◆ SmallDivisorsTest()

template<int PRECISION>
bool Int< PRECISION >::SmallDivisorsTest ( void ) const
inline

Definition at line 105 of file INT.H.

◆ Unsigned_Decode()

template<int PRECISION>
void Int< PRECISION >::Unsigned_Decode ( const unsigned char * from,
int frombytes )
inline

Definition at line 177 of file INT.H.

◆ Unsigned_Divide()

template<int PRECISION>
static void Int< PRECISION >::Unsigned_Divide ( Int< PRECISION > & remainder,
Int< PRECISION > & quotient,
const Int< PRECISION > & dividend,
const Int< PRECISION > & divisor )
inlinestatic

Definition at line 167 of file INT.H.

◆ Unsigned_Mult()

template<int PRECISION>
static Int Int< PRECISION >::Unsigned_Mult ( Int< PRECISION > const & multiplicand,
Int< PRECISION > const & multiplier )
inlinestatic

Definition at line 166 of file INT.H.

Friends And Related Symbol Documentation

◆ FN_TEMPLATE

template<int PRECISION>
Int< PRECISION > Gcd FN_TEMPLATE ( const Int< PRECISION > & ,
const Int< PRECISION > &  )
friend

◆ RemainderTable< Int< PRECISION > >

template<int PRECISION>
friend struct RemainderTable< Int< PRECISION > >
friend

Definition at line 198 of file INT.H.

Member Data Documentation

◆ Borrow

template<int PRECISION>
bool Int< PRECISION >::Borrow
static

Definition at line 193 of file INT.H.

◆ C0

template<int PRECISION>
unsigned char Int< PRECISION >::C0

Definition at line 61 of file blowfish.cpp.

◆ C1

template<int PRECISION>
unsigned char Int< PRECISION >::C1

Definition at line 60 of file blowfish.cpp.

◆ C2

template<int PRECISION>
unsigned char Int< PRECISION >::C2

Definition at line 59 of file blowfish.cpp.

◆ C3

template<int PRECISION>
unsigned char Int< PRECISION >::C3

Definition at line 58 of file blowfish.cpp.

◆ Carry

template<int PRECISION>
bool Int< PRECISION >::Carry
static

Definition at line 190 of file INT.H.

◆ [struct] [1/2]

struct { ... } Int< PRECISION >::Char

◆ [struct] [2/2]

struct { ... } Int< PRECISION >::Char

◆ Error

template<int PRECISION>
int Int< PRECISION >::Error
static

Definition at line 187 of file INT.H.

◆ Long

template<int PRECISION>
unsigned long Int< PRECISION >::Long

Definition at line 56 of file blowfish.cpp.

◆ reg

template<int PRECISION>
digit Int< PRECISION >::reg[PRECISION]

Definition at line 198 of file INT.H.

◆ Remainder

template<int PRECISION>
Int Int< PRECISION >::Remainder
static

Definition at line 196 of file INT.H.


The documentation for this union was generated from the following files: