diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:10:50 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-05-04 15:10:50 +0000 |
commit | d5c2286093d51a7cd8e4f2e1448473b5545001ea (patch) | |
tree | f27ba515a537694e503655577430ff6ce5d283f9 | |
parent | ca5713f67f7152d1054c0d6f75c9851f7b01f73c (diff) | |
download | cryptopp-d5c2286093d51a7cd8e4f2e1448473b5545001ea.tar.gz |
use Weak1 namespace
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@330 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r-- | arc4.cpp | 9 | ||||
-rw-r--r-- | arc4.h | 14 | ||||
-rw-r--r-- | md2.cpp | 4 | ||||
-rw-r--r-- | md2.h | 12 | ||||
-rw-r--r-- | md4.cpp | 4 | ||||
-rw-r--r-- | md4.h | 12 | ||||
-rw-r--r-- | md5.cpp | 4 | ||||
-rw-r--r-- | md5.h | 12 | ||||
-rw-r--r-- | pkcspad.cpp | 8 | ||||
-rw-r--r-- | pkcspad.h | 2 | ||||
-rw-r--r-- | rsa.h | 8 |
11 files changed, 49 insertions, 40 deletions
@@ -7,11 +7,11 @@ // completely in the public domain. #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "arc4.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void ARC4_TestInstantiations() { @@ -62,9 +62,10 @@ static inline unsigned int MakeByte(T &x, T &y, byte *s) return s[(a+b) & 0xff]; } -byte ARC4_Base::GenerateByte() +void ARC4_Base::GenerateBlock(byte *output, size_t size) { - return MakeByte(m_x, m_y, m_state); + while (size--) + *output++ = MakeByte(m_x, m_y, m_state); } void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length) @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! _ class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation @@ -15,7 +15,7 @@ public: static const char *StaticAlgorithmName() {return "ARC4";} - byte GenerateByte(); + void GenerateBlock(byte *output, size_t size); void DiscardBytes(size_t n); void ProcessData(byte *outString, const byte *inString, size_t length); @@ -55,12 +55,14 @@ protected: DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4) } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning #ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif @@ -15,11 +15,11 @@ */ #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md2.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { MD2::MD2() : m_X(48), m_C(16), m_buf(16) @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { /// <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a> class MD2 : public HashTransformation @@ -30,12 +30,14 @@ private: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning #ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif @@ -15,12 +15,12 @@ */ #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md4.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void MD4::InitState(HashWordType *state) { @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! <a href="http://www.weidai.com/scan-mirror/md.html#MD4">MD4</a> /*! \warning MD4 is considered insecure, and should not be used @@ -19,12 +19,14 @@ public: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning #ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif @@ -2,12 +2,12 @@ // any modifications are placed in the public domain #include "pch.h" -#define CRYPTOPP_ENABLE_NAMESPACE_WEAK +#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include "md5.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { void MD5_TestInstantiations() { @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -namespace Weak { +namespace Weak1 { //! <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a> class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5> @@ -17,12 +17,14 @@ public: }; } -#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK -using namespace Weak; +#if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1 +namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak +#else +using namespace Weak1; // import Weak1 into CryptoPP with warning #ifdef __GNUC__ -#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning." +#warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning." #else -#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please define CRYPTOPP_ENABLE_NAMESPACE_WEAK and prepend the class name with 'Weak::' to remove this warning.") +#pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.") #endif #endif diff --git a/pkcspad.cpp b/pkcspad.cpp index 0ce0aa5..e1f1d1e 100644 --- a/pkcspad.cpp +++ b/pkcspad.cpp @@ -11,11 +11,11 @@ NAMESPACE_BEGIN(CryptoPP) // more in dll.cpp -template<> const byte PKCS_DigestDecoration<Weak::MD2>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10}; -template<> const unsigned int PKCS_DigestDecoration<Weak::MD2>::length = sizeof(PKCS_DigestDecoration<Weak::MD2>::decoration); +template<> const byte PKCS_DigestDecoration<Weak1::MD2>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration<Weak1::MD2>::length = sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration); -template<> const byte PKCS_DigestDecoration<Weak::MD5>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10}; -template<> const unsigned int PKCS_DigestDecoration<Weak::MD5>::length = sizeof(PKCS_DigestDecoration<Weak::MD5>::decoration); +template<> const byte PKCS_DigestDecoration<Weak1::MD5>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10}; +template<> const unsigned int PKCS_DigestDecoration<Weak1::MD5>::length = sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration); template<> const byte PKCS_DigestDecoration<RIPEMD160>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14}; template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration); @@ -37,7 +37,7 @@ class SHA224; class SHA256; class SHA384; class SHA512; -namespace Weak { +namespace Weak1 { class MD2; class MD5; } @@ -162,11 +162,11 @@ typedef RSASS<PKCS1v15, SHA>::Signer RSASSA_PKCS1v15_SHA_Signer; typedef RSASS<PKCS1v15, SHA>::Verifier RSASSA_PKCS1v15_SHA_Verifier; namespace Weak { -typedef RSASS<PKCS1v15, MD2>::Signer RSASSA_PKCS1v15_MD2_Signer; -typedef RSASS<PKCS1v15, MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier; +typedef RSASS<PKCS1v15, Weak1::MD2>::Signer RSASSA_PKCS1v15_MD2_Signer; +typedef RSASS<PKCS1v15, Weak1::MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier; -typedef RSASS<PKCS1v15, MD5>::Signer RSASSA_PKCS1v15_MD5_Signer; -typedef RSASS<PKCS1v15, MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier; +typedef RSASS<PKCS1v15, Weak1::MD5>::Signer RSASSA_PKCS1v15_MD5_Signer; +typedef RSASS<PKCS1v15, Weak1::MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier; } NAMESPACE_END |