00001 #ifndef CRYPTOPP_SEAL_H
00002 #define CRYPTOPP_SEAL_H
00003
00004 #include "cryptlib.h"
00005 #include "misc.h"
00006
00007 NAMESPACE_BEGIN(CryptoPP)
00008
00010 class SEAL : public RandomNumberGenerator,
00011 public RandomAccessStreamCipher
00012 {
00013 public:
00014
00015
00016
00017 SEAL(const byte *key, word32 counter = 0, unsigned int L = 32*1024);
00018
00019 word32 NextCount() const {return counter+1;}
00020
00021 byte GenerateByte();
00022 byte ProcessByte(byte input)
00023 {return (input ^ SEAL::GenerateByte());}
00024
00025 void ProcessString(byte *outString, const byte *inString, unsigned int length);
00026 void ProcessString(byte *inoutString, unsigned int length)
00027 {SEAL::ProcessString(inoutString, inoutString, length);}
00028
00029 void Seek(unsigned long position);
00030
00031 enum {KEYLENGTH=20};
00032
00033 protected:
00034 void Generate(word32 in, byte *out) const;
00035 void IncrementCounter();
00036
00037 private:
00038 const unsigned int L;
00039 SecBlock<word32> R, S, T;
00040
00041 const word32 startCount;
00042 word32 counter;
00043 unsigned int position;
00044 SecByteBlock buffer;
00045 };
00046
00047 NAMESPACE_END
00048
00049 #endif