vlong.h
来自「rsa数字签名公钥加密私钥解密c++源代码」· C头文件 代码 · 共 40 行
H
40 行
class vlong // very long integer - can be used like long{public: // Standard arithmetic operators friend vlong operator +( const vlong& x, const vlong& y ); friend vlong operator -( const vlong& x, const vlong& y ); friend vlong operator *( const vlong& x, const vlong& y ); friend vlong operator /( const vlong& x, const vlong& y ); friend vlong operator %( const vlong& x, const vlong& y ); vlong& operator +=( const vlong& x ); vlong& operator -=( const vlong& x ); // Standard comparison operators friend inline int operator !=( const vlong& x, const vlong& y ){ return x.cf( y ) != 0; } friend inline int operator ==( const vlong& x, const vlong& y ){ return x.cf( y ) == 0; } friend inline int operator >=( const vlong& x, const vlong& y ){ return x.cf( y ) >= 0; } friend inline int operator <=( const vlong& x, const vlong& y ){ return x.cf( y ) <= 0; } friend inline int operator > ( const vlong& x, const vlong& y ){ return x.cf( y ) > 0; } friend inline int operator < ( const vlong& x, const vlong& y ){ return x.cf( y ) < 0; } // Construction and conversion operations vlong ( unsigned x=0 ); vlong ( const vlong& x ); ~vlong(); operator unsigned (); vlong& operator =(const vlong& x);private: class vlong_value * value; int negative; int cf( const vlong x ) const; void docopy(); friend class monty;};vlong modexp( const vlong & x, const vlong & e, const vlong & m ); // m must be oddvlong gcd( const vlong &X, const vlong &Y ); // greatest common denominatorvlong modinv( const vlong &a, const vlong &m ); // modular inverse
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?