⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flintpp.h

📁 flint库 RSA算法
💻 H
📖 第 1 页 / 共 2 页
字号:
  friend LINT StrongPrime (USHORT, STATEPRNG&);  friend LINT StrongPrime (USHORT, const LINT&, STATEPRNG&);  friend LINT StrongPrime (USHORT, USHORT, USHORT, USHORT, const LINT&, STATEPRNG&);  friend LINT StrongPrime (const LINT&, const LINT&, const LINT&, STATEPRNG&);  friend LINT StrongPrime (const LINT& pmin, const LINT&, USHORT, USHORT, USHORT, const LINT&, STATEPRNG&);  // Compatibility functions: Calls to Blum-Blum-Shub-Generator  friend LINT randBBS (int);  friend LINT randBBS (const LINT&, const LINT&);  friend int seedBBS (const LINT&);  // Compatibility functions: Calls to 64 bit linear congruential generator  // Do not use this generator for cryptographical purposes!  friend LINT randl (int);  friend LINT randl (const LINT&, const LINT&);  friend void seedl (const LINT&);  // Conversion  friend char* lint2str (const LINT&, USHORT, int = 0);  friend UCHAR* lint2byte (const LINT&, int*);  // Export as CLINT type  friend clint* lint2clint (const LINT& ln);  // Overloading of ostream insert operator << for LINT-objects  friend ostream& operator<< (ostream& s, const LINT& ln);  // Overloading of fstream/istream/ofstream insert operators >>,<<  // for file-IO of LINT objects  friend fstream& operator<< (fstream& s, const LINT& ln);  friend ofstream& operator<< (ofstream& s, const LINT& ln);  friend fstream& operator>> (fstream& s, LINT& ln);  friend ifstream& operator>> (ifstream& s, LINT& ln);  // LINT-MEMBERS  // Constructors  LINT (void);                  // Constructor  1  LINT (const char*, int);      // Constructor  2  LINT (const UCHAR*, int);     // Constructor  3  LINT (const char*);           // Constructor  4  LINT (const LINT&);           // Constructor  5  (Copy)  LINT (signed int);            // Constructor  6  LINT (signed long);           // Constructor  7  LINT (unsigned char);         // Constructor  8  LINT (unsigned short);        // Constructor  9  LINT (unsigned int);          // Constructor 10  LINT (unsigned long);         // Constructor 11  LINT (const CLINT);           // Constructor 12  //  Destructor  ~LINT (void)    {#ifdef FLINT_SECURE      purge_l (n_l);#endif // FLINT_SECURE      delete [] n_l;    }  // Overloaded operators, implemented as member functions  // left (implicit) argument is always of type LINT  // Assignment  const LINT& operator= (const LINT&);  // Arithmetic  const LINT& operator++ (void);  const LINT operator++ (int);  const LINT& operator-- (void);  const LINT operator-- (int);  const LINT& operator+= (const LINT&);  const LINT& operator-= (const LINT&);  const LINT& operator*= (const LINT&);  const LINT& operator/= (const LINT&);  const LINT& operator%= (const LINT&);  // Bitwise and Boolean functions  const LINT& operator<<= (int);  const LINT& operator>>= (int);  const LINT& operator^= (const LINT&);  const LINT& operator|= (const LINT&);  const LINT& operator&= (const LINT&);  // Member functions  // Arithmetic  const LINT& add (const LINT&);  const LINT& sub (const LINT&);  const LINT& mul (const LINT&);  const LINT& sqr (void);  const LINT& divr (const LINT&, LINT&);  const LINT& mod (const LINT&);  const LINT& mod2 (USHORT);  // Modular arithmetic  const LINT& madd (const LINT&, const LINT&);  const LINT& msub (const LINT&, const LINT&);  const LINT& mmul (const LINT&, const LINT&);  const LINT& msqr (const LINT&);  const LINT& mexp (const LINT&, const LINT&);  const LINT& mexp (USHORT, const LINT&);  const LINT& mexp5m (const LINT&, const LINT&);  const LINT& mexpkm (const LINT&, const LINT&);  const LINT& mexp2 (USHORT, const LINT&);  const LINT& shift (int);  // Number theoretic member Funktionen  LINT gcd (const LINT&) const;  LINT xgcd (const LINT&, LINT&, int&, LINT&, int&) const;  LINT inv (const LINT&) const;  LINT lcm (const LINT&) const;  int jacobi (const LINT&) const;  LINT root (void) const;  LINT root (const LINT&) const;  LINT root (const LINT&, const LINT&) const;  int twofact (LINT&) const;  unsigned int ld (void) const;  int isprime (int noofsmallprimes = 302, int iterations = 0) const;  LINT issqr (void) const;  int mequ (const LINT&, const LINT&) const;  LINT chinrem (const LINT&, const LINT&, const LINT&) const;  int iseven (void) const;  int isodd (void) const;  // Bit-access  const LINT& setbit (unsigned int);  const LINT& clearbit (unsigned int);  int testbit (unsigned int) const;  // Swapping  LINT& fswap (LINT&);  // Purging of LINT-variables, overwriting with 0  void purge (void);  // Conversion & Input/Output  enum {      lintdec        = 0x010,      lintoct        = 0x020,      linthex        = 0x040,      lintshowbase   = 0x080,      lintuppercase  = 0x100,      lintbin        = 0x200,      lintshowlength = 0x400  };  static long flags (void);  static long flags (ostream&);  static long setf (long int);  static long setf (ostream&, long int);  static long unsetf (long int);  static long unsetf (ostream&, long int);  static long restoref (long int);  static long restoref (ostream&, long int);  // LINT-to-string conversion  inline char* hexstr (void) const    {      return lint2str (16);    }  inline char* decstr (void) const    {      return lint2str (10);    }  inline char* octstr (void) const    {      return lint2str (8);    }  inline char* binstr (void) const    {      return lint2str (2);    }  // Conversion to string and bytevector  char* lint2str (USHORT, int = 0) const;  UCHAR* lint2byte (int*) const;  // Export as CLINT type  clint* lint2clint (void) const;  // preformatted output  inline void disp (char* str)    {      cout << str << lint2str (16) << endl << ld () << " bit\n";    }  // Set user-defined error handler  static void Set_LINT_Error_Handler (void (*)(LINT_ERRORS, const char*, int, int, const char*));  //Get Error/Warning-Status  LINT_ERRORS Get_Warning_Status (void); private:  // Pointer to type CLINT  clint* n_l;  // Status after an operation on a LINT object  LINT_ERRORS status;  // LINT::Default-Error-Handler  static void panic (LINT_ERRORS, const char*, int, int, const char* = "flintpp.cpp");  // Dummy object of class LintInit  static LintInit setup;  // Pointer to ios flag register to be allocated   static long flagsindex;};// CLASS LINT ends///////////////////////////////////////////////////////////////////////////////// Some auxiliary functions for LINT manipulators// ostream format functionsostream& _SetLintFlags (ostream& , int);ostream& _ResetLintFlags (ostream& , int);// Container-class LINT_omaniptemplate <class T>class LINT_omanip{ public:  LINT_omanip (ostream&(*g)(ostream&, T), T j): i(j), f(g) {}  friend ostream& operator <<(ostream& os, const LINT_omanip<T>& m)    {      return (*m.f) (os, m.i);    } protected:  T i;  ostream& (*f)(ostream&, T);}; //lint !e1712  Don't complain about missing default constructor// Manipulators for output format of LINT objectsLINT_omanip <int> SetLintFlags (int);LINT_omanip <int> ResetLintFlags (int);ostream& LintHex (ostream&);ostream& LintDec (ostream&);ostream& LintOct (ostream&);ostream& LintBin (ostream&);ostream& LintUpr (ostream&);ostream& LintLwr (ostream&);ostream& LintShowbase (ostream&);ostream& LintNobase (ostream&);ostream& LintShowlength (ostream&);ostream& LintNolength (ostream&);// Templates for platform-independent writing and reading of USHORT valuestemplate <class T>int read_ind_ushort (T& s, clint* dest){  UCHAR buff[sizeof (clint)];  unsigned i;  s.read ((char*)buff, sizeof (clint));  if (!s)    {      return -1;    }  else    {      *dest = 0;      for (i = 0; i < sizeof (clint); i++)        {          *dest |= ((clint)buff[i]) << (i << 3);        }      return 0;    }}template <class T>int write_ind_ushort (T& s, clint src){  UCHAR buff[sizeof (clint)];  unsigned i, j;  for (i = 0, j = 0; i < sizeof (clint); i++, j = i << 3)    {      buff[i] = (UCHAR)((src & (0xff << j)) >> j);    }  s.write ((const char*)buff, sizeof (clint));  if (!s)    {      return -1;    }  else    {      return 0;    }}// min, max as template-inline-functions// (Acc. Scott Meyers,"Effective C++", 2nd. Ed. Addison-Wesley 1998)// min und max should be present in  C++-Standard Template Library, but...#if !defined FLINTPP_ANSI || (defined __IBMCPP__ && (__IBMCPP__ <=300)) || (defined _MSC_VER && (_MSC_VER <= 1200)) || defined __WATCOMC__#ifndef mintemplate <class T>inline const T& min (const T& a, const T& b){ return a < b ? a : b; }#endif // min#ifndef maxtemplate <class T>inline const T& max (const T& a, const T& b){ return a > b ? a : b; }#endif // max#endif // !(defined __IBMCPP__ || defined FLINTPP_ANSI)#endif // __FLINTPPH__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -