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

blumshub.h

00001 #ifndef CRYPTOPP_BLUMSHUB_H
00002 #define CRYPTOPP_BLUMSHUB_H
00003 
00004 #include "cryptlib.h"
00005 #include "modarith.h"
00006 
00007 NAMESPACE_BEGIN(CryptoPP)
00008 
00009 class BlumGoldwasserPublicKey;
00010 class BlumGoldwasserPrivateKey;
00011 
00013 class PublicBlumBlumShub : public RandomNumberGenerator,
00014                                                    public virtual StreamCipher
00015 {
00016 public:
00017         PublicBlumBlumShub(const Integer &n, const Integer &seed);
00018 
00019         unsigned int GenerateBit();
00020         byte GenerateByte();
00021 
00022         byte ProcessByte(byte input)
00023                 {return (input ^ GetByte());}
00024 
00025 protected:
00026         const ModularArithmetic modn;
00027         const int maxBits;
00028         Integer current;
00029         int bitsLeft;
00030 
00031         friend class BlumGoldwasserPublicKey;
00032         friend class BlumGoldwasserPrivateKey;
00033 };
00034 
00036 class BlumBlumShub : public PublicBlumBlumShub,
00037                                          public RandomAccessStreamCipher
00038 {
00039 public:
00040         // Make sure p and q are both primes congruent to 3 mod 4 and at least 512 bits long,
00041         // seed is the secret key and should be about as big as p*q
00042         BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed);
00043         void Seek(unsigned long index);
00044 
00045 protected:
00046         const Integer p, q;
00047         const Integer x0;
00048 };
00049 
00050 NAMESPACE_END
00051 
00052 #endif

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