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

📄 vlong.h

📁 椭圆曲线密码C实现的
💻 H
字号:

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 );
	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 ();
	
private:
	class vlong_value * pValue;
	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 odd
vlong gcd( const vlong &X, const vlong &Y ); // greatest common denominator
vlong modinv( const vlong &a, const vlong &m ); // modular inverse

⌨️ 快捷键说明

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