📄 cbc.h
字号:
#ifndef CRYPTOPP_CBC_H
#define CRYPTOPP_CBC_H
#include "filters.h"
#include "modes.h"
NAMESPACE_BEGIN(CryptoPP)
class CBCPaddedEncryptor : public Filter, protected CipherMode
{
public:
CBCPaddedEncryptor(const BlockTransformation &cipher, const byte *IV, BufferedTransformation *outQueue = NULL);
void Put(byte inByte);
void Put(const byte *inString, unsigned int length);
void InputFinished();
private:
void ProcessBuf();
unsigned int counter;
};
class CBCPaddedDecryptor : public Filter, protected CipherMode
{
public:
CBCPaddedDecryptor(const BlockTransformation &cipher, const byte *IV, BufferedTransformation *outQueue = NULL);
void Put(byte inByte);
void Put(const byte *inString, unsigned int length);
void InputFinished();
private:
friend class DefaultDecryptor; // need access to ProcessBuf()
void ProcessBuf();
unsigned int counter;
SecByteBlock temp;
};
/// CBC mode encryptor with ciphertext stealing
/** Ciphertext stealing requires at least cipher.BlockSize() bytes of plaintext.
Shorter plaintext will be padded with '\0's
*/
class CBC_CTS_Encryptor : public Filter, protected CipherMode
{
public:
CBC_CTS_Encryptor(const BlockTransformation &cipher, const byte *IV, BufferedTransformation *outQueue = NULL);
void Put(byte inByte);
void Put(const byte *inString, unsigned int length);
void InputFinished();
private:
void ProcessBuf();
unsigned int counter;
bool bFirstBlock;
};
class CBC_CTS_Decryptor : public Filter, protected CipherMode
{
public:
CBC_CTS_Decryptor(const BlockTransformation &cipher, const byte *IV, BufferedTransformation *outQueue = NULL);
void Put(byte inByte);
void Put(const byte *inString, unsigned int length);
void InputFinished();
private:
friend class DefaultDecryptor; // need access to ProcessBuf()
void ProcessBuf();
unsigned int counter;
bool bFirstBlock;
SecByteBlock temp;
SecByteBlock buffer2;
};
NAMESPACE_END
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -