diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-20 16:21:49 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-20 16:21:49 +0000 |
commit | f424a18112032cf61d2871a6b91a5af607c171ae (patch) | |
tree | 88fedc4e28941ceecda7026f0b06eba6271f91d5 /plugins/CryptoPP/crypto/src/blumshub.h | |
parent | bfe1bd0fc087be44c70904aee0fe4276643d206d (diff) |
CryptoPP:
changed folder structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@1083 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/crypto/src/blumshub.h')
-rw-r--r-- | plugins/CryptoPP/crypto/src/blumshub.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/CryptoPP/crypto/src/blumshub.h b/plugins/CryptoPP/crypto/src/blumshub.h new file mode 100644 index 0000000000..538c1520d5 --- /dev/null +++ b/plugins/CryptoPP/crypto/src/blumshub.h @@ -0,0 +1,53 @@ +#ifndef CRYPTOPP_BLUMSHUB_H
+#define CRYPTOPP_BLUMSHUB_H
+
+#include "modarith.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+class BlumGoldwasserPublicKey;
+class BlumGoldwasserPrivateKey;
+
+//! BlumBlumShub without factorization of the modulus
+class PublicBlumBlumShub : public RandomNumberGenerator,
+ public StreamTransformation
+{
+public:
+ PublicBlumBlumShub(const Integer &n, const Integer &seed);
+
+ unsigned int GenerateBit();
+ byte GenerateByte();
+ void GenerateBlock(byte *output, size_t size);
+ void ProcessData(byte *outString, const byte *inString, size_t length);
+
+ bool IsSelfInverting() const {return true;}
+ bool IsForwardTransformation() const {return true;}
+
+protected:
+ ModularArithmetic modn;
+ word maxBits, bitsLeft;
+ Integer current;
+
+ friend class BlumGoldwasserPublicKey;
+ friend class BlumGoldwasserPrivateKey;
+};
+
+//! BlumBlumShub with factorization of the modulus
+class BlumBlumShub : public PublicBlumBlumShub
+{
+public:
+ // Make sure p and q are both primes congruent to 3 mod 4 and at least 512 bits long,
+ // seed is the secret key and should be about as big as p*q
+ BlumBlumShub(const Integer &p, const Integer &q, const Integer &seed);
+
+ bool IsRandomAccess() const {return true;}
+ void Seek(lword index);
+
+protected:
+ const Integer p, q;
+ const Integer x0;
+};
+
+NAMESPACE_END
+
+#endif
|