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

📄 vlong.h

📁 椭圆曲线密码C实现的
💻 H
字号:
#include "uvlong.h"

//---------------------------------------------------------------------------
class vlong	//:public  uvlong		// Provides storage allocation and index checking
{
	friend class CDBlock;
	friend class public_key;
public:
	vlong& operator  =( const vlong& x );
	vlong& operator +=( const vlong& x );
	vlong& operator -=( const vlong& x );

	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 );

	// Standard comparison operators
	friend int operator !=( const vlong& x, const vlong& y ){ return comp_vl(x, y ) != 0;	}
	friend int operator ==( const vlong& x, const vlong& y ){ return comp_vl(x, y ) == 0;	}
	friend int operator >=( const vlong& x, const vlong& y ){ return comp_vl(x, y ) >= 0;	}
	friend int operator <=( const vlong& x, const vlong& y ){ return comp_vl(x, y ) <= 0;	}
	friend int operator > ( const vlong& x, const vlong& y ){ return comp_vl(x, y ) > 0;	}
	friend int operator < ( const vlong& x, const vlong& y ){ return comp_vl(x, y ) < 0;	}

	/*比较a和b两大数*/
	friend	int	comp_vl	( const vlong a,  const vlong b);
	/*找一个大的素数*/
	friend	bool	findprime (	vlong &out,	unsigned int bitlen );
	/*生成一个bitlen位的随机数*/
	friend	bool	randval	( vlong &out,	unsigned int bitlen );
	/*求乘法逆元方法1*/
	friend	bool	modinv1 ( const vlong &e, const vlong &m, vlong &u, vlong &v );
	/*求乘法逆元方法2*/
	friend	bool	modinv2	( const vlong &e, const vlong &m, vlong &d );	
	/*求vlong型的次幂求模*/
	friend	bool	modexp	( const vlong & m, const vlong & e, const vlong & mod, vlong & result);
	
	vlong ( int	x = 0 );
	vlong ( const vlong& x );
	virtual~vlong();
	operator unsigned ();

private:
	int				m_nNegative;
	class	uvlong*	m_pValue;
public:
	ushort		  *	m_clint;

};

⌨️ 快捷键说明

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