📄 c_rsa.h
字号:
// C_RSA.h: interface for the C_RSA class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_C_RSA_H__DFA1ACD6_44FD_49A6_BCE5_9EB1A6A6CC1D__INCLUDED_)
#define AFX_C_RSA_H__DFA1ACD6_44FD_49A6_BCE5_9EB1A6A6CC1D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <string>
using namespace std;
class C_RSA
{
public:
struct S_CODE
{
int nEncryptCode;
int nDecryptCode;
int nN;
};
typedef S_CODE ENCRYPTTYPE;
public:
C_RSA();
virtual ~C_RSA();
public:
/// First produce the encrypt code & decrypt code
ENCRYPTTYPE & ProduceEncryptInFo(int nP, int nQ);
/// Encrypt the proclaim
bool Encrypt(string &strContent, string & strEncryptContent);
/// Decrypt the content
bool Decrypt(string & strEncryptContent, string &strContent, int nDecryptCode, int nN);
/// Auto produce encrypt code & decrypt code
ENCRYPTTYPE & AutoProduceEncryptInFo(void);
private:
bool IsPrime(int nX);
int Gcd(int nA, int nB);
void Euler(int nE, int nFin);
void ProduceEncryCode(int nFin);
int Power(int nA, int nN, int nM);
private:
int m_nP; //P factor
int m_nQ; //Q factor
ENCRYPTTYPE m_nEncrytInFo; // information
};
#endif // !defined(AFX_C_RSA_H__DFA1ACD6_44FD_49A6_BCE5_9EB1A6A6CC1D__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -