use Weak1 namespace

import/raw
weidai 2007-05-04 15:10:50 +00:00
parent 67ad23f902
commit 6abe3715d8
11 changed files with 53 additions and 44 deletions

View File

@ -7,11 +7,11 @@
// completely in the public domain. // completely in the public domain.
#include "pch.h" #include "pch.h"
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "arc4.h" #include "arc4.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
void ARC4_TestInstantiations() void ARC4_TestInstantiations()
{ {
@ -62,9 +62,10 @@ static inline unsigned int MakeByte(T &x, T &y, byte *s)
return s[(a+b) & 0xff]; 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) void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length)

View File

@ -5,7 +5,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
//! _ //! _
class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation 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";} static const char *StaticAlgorithmName() {return "ARC4";}
byte GenerateByte(); void GenerateBlock(byte *output, size_t size);
void DiscardBytes(size_t n); void DiscardBytes(size_t n);
void ProcessData(byte *outString, const byte *inString, size_t length); void ProcessData(byte *outString, const byte *inString, size_t length);
@ -55,12 +55,14 @@ protected:
DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4) DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4)
} }
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
using namespace Weak; namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
#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."
#else #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.") 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 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 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
#endif #endif
#endif #endif

View File

@ -15,11 +15,11 @@
*/ */
#include "pch.h" #include "pch.h"
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "md2.h" #include "md2.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
MD2::MD2() MD2::MD2()
: m_X(48), m_C(16), m_buf(16) : m_X(48), m_C(16), m_buf(16)

View File

@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
/// <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a> /// <a href="http://www.cryptolounge.org/wiki/MD2">MD2</a>
class MD2 : public HashTransformation class MD2 : public HashTransformation
@ -30,12 +30,14 @@ private:
}; };
} }
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
using namespace Weak; namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
#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."
#else #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.") 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 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 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
#endif #endif
#endif #endif

View File

@ -15,12 +15,12 @@
*/ */
#include "pch.h" #include "pch.h"
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "md4.h" #include "md4.h"
#include "misc.h" #include "misc.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
void MD4::InitState(HashWordType *state) void MD4::InitState(HashWordType *state)
{ {

View File

@ -5,7 +5,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
//! <a href="http://www.weidai.com/scan-mirror/md.html#MD4">MD4</a> //! <a href="http://www.weidai.com/scan-mirror/md.html#MD4">MD4</a>
/*! \warning MD4 is considered insecure, and should not be used /*! \warning MD4 is considered insecure, and should not be used
@ -19,12 +19,14 @@ public:
}; };
} }
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
using namespace Weak; namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
#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."
#else #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.") 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 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 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
#endif #endif
#endif #endif

View File

@ -2,12 +2,12 @@
// any modifications are placed in the public domain // any modifications are placed in the public domain
#include "pch.h" #include "pch.h"
#define CRYPTOPP_ENABLE_NAMESPACE_WEAK #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
#include "md5.h" #include "md5.h"
#include "misc.h" #include "misc.h"
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
void MD5_TestInstantiations() void MD5_TestInstantiations()
{ {

View File

@ -5,7 +5,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
namespace Weak { namespace Weak1 {
//! <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a> //! <a href="http://www.cryptolounge.org/wiki/MD5">MD5</a>
class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5> class MD5 : public IteratedHashWithStaticTransform<word32, LittleEndian, 64, 16, MD5>
@ -17,12 +17,14 @@ public:
}; };
} }
#ifndef CRYPTOPP_ENABLE_NAMESPACE_WEAK #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
using namespace Weak; namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
#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."
#else #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.") 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 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 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
#endif #endif
#endif #endif

View File

@ -11,11 +11,11 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// more in dll.cpp // 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 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<Weak::MD2>::length = sizeof(PKCS_DigestDecoration<Weak::MD2>::decoration); 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 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<Weak::MD5>::length = sizeof(PKCS_DigestDecoration<Weak::MD5>::decoration); 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 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); template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);

View File

@ -37,7 +37,7 @@ class SHA224;
class SHA256; class SHA256;
class SHA384; class SHA384;
class SHA512; class SHA512;
namespace Weak { namespace Weak1 {
class MD2; class MD2;
class MD5; class MD5;
} }

View File

@ -162,11 +162,11 @@ typedef RSASS<PKCS1v15, SHA>::Signer RSASSA_PKCS1v15_SHA_Signer;
typedef RSASS<PKCS1v15, SHA>::Verifier RSASSA_PKCS1v15_SHA_Verifier; typedef RSASS<PKCS1v15, SHA>::Verifier RSASSA_PKCS1v15_SHA_Verifier;
namespace Weak { namespace Weak {
typedef RSASS<PKCS1v15, MD2>::Signer RSASSA_PKCS1v15_MD2_Signer; typedef RSASS<PKCS1v15, Weak1::MD2>::Signer RSASSA_PKCS1v15_MD2_Signer;
typedef RSASS<PKCS1v15, MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier; typedef RSASS<PKCS1v15, Weak1::MD2>::Verifier RSASSA_PKCS1v15_MD2_Verifier;
typedef RSASS<PKCS1v15, MD5>::Signer RSASSA_PKCS1v15_MD5_Signer; typedef RSASS<PKCS1v15, Weak1::MD5>::Signer RSASSA_PKCS1v15_MD5_Signer;
typedef RSASS<PKCS1v15, MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier; typedef RSASS<PKCS1v15, Weak1::MD5>::Verifier RSASSA_PKCS1v15_MD5_Verifier;
} }
NAMESPACE_END NAMESPACE_END