00001
#ifndef CRYPTOPP_BLOWFISH_H
00002
#define CRYPTOPP_BLOWFISH_H
00003
00004
00005
00006
#include "seckey.h"
00007
#include "secblock.h"
00008
00009 NAMESPACE_BEGIN(CryptoPP)
00010
00011
00012 struct
Blowfish_Info : public
FixedBlockSize<8>, public
VariableKeyLength<16, 1, 56>, public
FixedRounds<16>
00013 {
00014
static const char *StaticAlgorithmName() {
return "Blowfish";}
00015 };
00016
00017
00018 class Blowfish :
public Blowfish_Info,
public BlockCipherDocumentation
00019 {
00020
class CRYPTOPP_NO_VTABLE Base :
public BlockCipherImpl<Blowfish_Info>
00021 {
00022
public:
00023
void ProcessAndXorBlock(
const byte *inBlock,
const byte *xorBlock, byte *outBlock)
const;
00024
void UncheckedSetKey(
CipherDir direction,
const byte *key_string,
unsigned int keylength);
00025
00026
private:
00027
void crypt_block(
const word32 in[2], word32 out[2])
const;
00028
00029
static const word32 p_init[ROUNDS+2];
00030
static const word32 s_init[4*256];
00031
00032 FixedSizeSecBlock<word32, ROUNDS+2> pbox;
00033 FixedSizeSecBlock<word32, 4*256> sbox;
00034 };
00035
00036
public:
00037 typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
00038 typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
00039 };
00040
00041
typedef Blowfish::Encryption BlowfishEncryption;
00042
typedef Blowfish::Decryption BlowfishDecryption;
00043
00044 NAMESPACE_END
00045
00046
#endif