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

📄 blumgold.h

📁 300种加密解密算法
💻 H
字号:
#ifndef CRYPTOPP_BLUMGOLD_H
#define CRYPTOPP_BLUMGOLD_H

#include "cryptlib.h"
#include "integer.h"

NAMESPACE_BEGIN(CryptoPP)

class BlumGoldwasserPublicKey : public PK_Encryptor
{
public:
	// you can use the default copy constructor to make a BlumGoldwasserPublicKey
	// out of a BlumGoldwasserPrivateKey
	BlumGoldwasserPublicKey(const Integer &n);
	BlumGoldwasserPublicKey(BufferedTransformation &bt);

	void DEREncode(BufferedTransformation &bt) const;

	void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText);

	unsigned int MaxPlainTextLength(unsigned int cipherTextLength) const;
	unsigned int CipherTextLength(unsigned int plainTextLength) const;

protected:
	BlumGoldwasserPublicKey() {}

	Integer n;           // these are only modified in constructors
	unsigned int modulusLen;
};

class BlumGoldwasserPrivateKey : public BlumGoldwasserPublicKey, public PK_Decryptor
{
public:
	BlumGoldwasserPrivateKey(const Integer &n, const Integer &p, const Integer &q, const Integer &u);
	// generate a random private key
	BlumGoldwasserPrivateKey(RandomNumberGenerator &rng, unsigned int keybits);
	BlumGoldwasserPrivateKey(BufferedTransformation &bt);

	void DEREncode(BufferedTransformation &bt) const;

	unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText);

protected:
	Integer p, q, u;
};

NAMESPACE_END

#endif

⌨️ 快捷键说明

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