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

📄 blowfish.h

📁 各种加密算法的集合
💻 H
字号:
#ifndef CRYPTOPP_BLOWFISH_H 
#define CRYPTOPP_BLOWFISH_H 
 
#include "cryptlib.h" 
#include "misc.h" 
 
NAMESPACE_BEGIN(CryptoPP) 
 
class Blowfish : public BlockTransformation 
{ 
public: 
	Blowfish(const byte *key_string, unsigned int keylength, CipherDir direction); 
 
	void ProcessBlock(byte * inoutBlock) const 
		{Blowfish::ProcessBlock(inoutBlock, inoutBlock);} 
	void ProcessBlock(const byte *inBlock, byte *outBlock) const; 
 
	// value of KEYLENGTH is default only 
	enum {KEYLENGTH=16, BLOCKSIZE=8, ROUNDS=16}; 
	unsigned int BlockSize() const {return BLOCKSIZE;} 
 
private: 
	void crypt_block(const word32 in[2], word32 out[2]) const; 
 
	static const word32 p_init[ROUNDS+2]; 
	static const word32 s_init[4*256]; 
	SecBlock<word32> pbox, sbox; 
}; 
 
class BlowfishEncryption : public Blowfish 
{ 
public: 
	BlowfishEncryption(const byte *key_string, unsigned int keylength=KEYLENGTH) 
		: Blowfish(key_string, keylength, ENCRYPTION) {} 
}; 
 
class BlowfishDecryption : public Blowfish 
{ 
public: 
	BlowfishDecryption(const byte *key_string, unsigned int keylength=KEYLENGTH) 
		: Blowfish(key_string, keylength, DECRYPTION) {} 
}; 
 
NAMESPACE_END 
 
#endif 

⌨️ 快捷键说明

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