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

📄 bigint.h

📁 rsa加密算法的vc实现
💻 H
字号:
#ifndef BIGINT_H
#define BIGINT_H

#include"predefine.h"
class BigInt{
public:
	BigInt();
	~BigInt();
	void setZero();
	void loadDEC(const char* str, const int length);//
	void loadHEX(const char* str, const int length);//
	void loadSTR(const char* str, const int length);

	char* outputDEC(int& length);
	char* outputHEX(int& length);
	char* outputSTR(int& length);

	BigInt operator + (const BigInt& p) const;
	BigInt operator + (const unsigned int& p) const;
	BigInt operator - (const BigInt& p) const;
	BigInt operator - (const unsigned int& p) const;
	BigInt operator * (const BigInt& p) const;
	BigInt operator * (const unsigned int& p) const;
	BigInt operator / (const BigInt& p);
	BigInt operator / (const unsigned int& p);
	BigInt operator % (const BigInt& p) const;
	unsigned int operator % (const unsigned int& p) const;
	bool operator > (const BigInt& p) const;
	bool operator > (const unsigned int p) const;
	bool operator == (const BigInt& p) const;
	bool operator != (const BigInt& p) const;
	BigInt& operator <<= (int iBit);
	BigInt& operator >>= (int iBit);
	BigInt& operator += (const unsigned int& p);
	BigInt& operator = (const BigInt& p);
	BigInt& operator = (const unsigned int& p);
	BigInt& operator ++ ();
	BigInt& operator -- ();

	bool BIlisZero() const;
	int BICompareABS(const BigInt& p) const;
	int BICompareABS(const unsigned int& p) const;

	BigInt BIdivision(const BigInt& p, BigInt& pr);
	unsigned int getLast32Bit();
	void copy(const BigInt& p);
	void add(const BigInt& p, BigInt& temp) const;
	void minuse(const BigInt& p, BigInt& temp) const;
	void add(const unsigned int& p,BigInt& temp) const;
	void minuse(const unsigned int& p,BigInt& temp) const;
	void clear();
	void MakeClose(BigInt& p);
	BigInt BIinverse(const BigInt& p) const;
	int nodeNumber() const;
	intNode* getHead() const;
	void print(int choose);
//	void MakeModMultTable(const BigInt& pp);
//	BigInt MontMult(const BigInt& p1, const BigInt& p2, const BigInt pp);
//	BigInt MontExpo(const BigInt& p1, const BigInt& p2, const BigInt pp);
private:
	intNode* head;
	bool positive;
friend BigInt BIgcd(const BigInt& p1, const BigInt& p2);
friend void BIswap(BigInt& a, BigInt& b);
friend BigInt BImodmul(const BigInt& p1, const BigInt& p2, const BigInt pp);
friend BigInt BImodmul2(const BigInt& p1, const BigInt& p2, const BigInt pp);
friend void MakeModBaseTable(const BigInt& pp);
friend BigInt BImodexp2(const BigInt& p1, const BigInt& p2, const BigInt pp);
friend BigInt BImodexp(const BigInt& p1, const BigInt& p2, const BigInt pp);
friend BigInt BImodpow2(const BigInt& p1, const BigInt& pp, const int& d);
friend void MakePreTable(const BigInt& p, const BigInt& pp);
};

#include"BigInt.cpp"

#endif

⌨️ 快捷键说明

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