Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

seal.h

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         // If you plan to encrypt more than one message with a key,
00015         // you must call NextCount() after each message, save the count,
00016         // and initialize SEAL with it for the next message.
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

Generated at Mon Jan 15 01:16:36 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000