Click here to Skip to main content
15,912,285 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to reverse a vertical slider Pin
Iain Clarke, Warrior Programmer7-Apr-08 22:01
Iain Clarke, Warrior Programmer7-Apr-08 22:01 
QuestionHow to use Namespaces created in different projects in the same solution? Pin
pabloraul1-Apr-08 6:21
pabloraul1-Apr-08 6:21 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
led mike1-Apr-08 6:51
led mike1-Apr-08 6:51 
GeneralRe: How to use Namespaces created in different projects in the same solution? [modified] Pin
pabloraul1-Apr-08 7:02
pabloraul1-Apr-08 7:02 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
led mike1-Apr-08 7:13
led mike1-Apr-08 7:13 
JokeRe: How to use Namespaces created in different projects in the same solution? Pin
pabloraul1-Apr-08 7:23
pabloraul1-Apr-08 7:23 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
Mark Salsbery1-Apr-08 7:34
Mark Salsbery1-Apr-08 7:34 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
pabloraul1-Apr-08 8:12
pabloraul1-Apr-08 8:12 
include path problem, im gonna research about that.

about the namespace begin im gonna post few of the files for you to see at least how its supposed to work. wei dai wrote it somehow and it works, i just need to use that library in order to use cryptography in my solution.

here is a picture of the object browser for you to see that CryptoPP is a namespace



argnames.h
#ifndef CRYPTOPP_ARGNAMES_H<br />
#define CRYPTOPP_ARGNAMES_H<br />
<br />
#include "cryptlib.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
DOCUMENTED_NAMESPACE_BEGIN(Name)<br />
<br />
#define CRYPTOPP_DEFINE_NAME_STRING(name)	inline const char *name() {return #name;}<br />
<br />
CRYPTOPP_DEFINE_NAME_STRING(ValueNames)			//!< string, a list of value names with a semicolon (';') after each name<br />
CRYPTOPP_DEFINE_NAME_STRING(Version)			//!< int<br />
CRYPTOPP_DEFINE_NAME_STRING(Seed)				//!< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(Key)				//!< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(IV)					//!< const byte *<br />
CRYPTOPP_DEFINE_NAME_STRING(StolenIV)			//!< byte *<br />
CRYPTOPP_DEFINE_NAME_STRING(Rounds)				//!< int<br />
CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize)		//!< int<br />
CRYPTOPP_DEFINE_NAME_STRING(WordSize)			//!< int, in bytes<br />
CRYPTOPP_DEFINE_NAME_STRING(BlockSize)			//!< int, in bytes<br />
CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength)	//!< int, in bits<br />
CRYPTOPP_DEFINE_NAME_STRING(KeySize)			//!< int, in bits<br />
CRYPTOPP_DEFINE_NAME_STRING(ModulusSize)		//!< int, in bits<br />
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize)	//!< int, in bits<br />
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)//!< int, in bits<br />
CRYPTOPP_DEFINE_NAME_STRING(Modulus)			//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(PublicExponent)		//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(PublicElement)		//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder)		//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(Cofactor)			//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator)	//!< Integer, ECP::Point, or EC2N::Point<br />
CRYPTOPP_DEFINE_NAME_STRING(Curve)				//!< ECP or EC2N<br />
CRYPTOPP_DEFINE_NAME_STRING(GroupOID)			//!< OID<br />
CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector)		//!< const PrimeSelector *<br />
CRYPTOPP_DEFINE_NAME_STRING(Prime1)				//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(Prime2)				//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(ModPrime2PrivateExponent)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(MultiplicativeInverseOfPrime2ModPrime1)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime1)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime2)	//!< Integer<br />
CRYPTOPP_DEFINE_NAME_STRING(PutMessage)			//!< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(TruncatedDigestSize)	//!< int<br />
CRYPTOPP_DEFINE_NAME_STRING(HashVerificationFilterFlags)		//!< word32<br />
CRYPTOPP_DEFINE_NAME_STRING(SignatureVerificationFilterFlags)	//!< word32<br />
CRYPTOPP_DEFINE_NAME_STRING(InputBuffer)		//!< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(OutputBuffer)		//!< ByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(InputFileName)		//!< const char *<br />
CRYPTOPP_DEFINE_NAME_STRING(InputStreamPointer)	//!< std::istream *<br />
CRYPTOPP_DEFINE_NAME_STRING(InputBinaryMode)	//!< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(OutputFileName)		//!< const char *<br />
CRYPTOPP_DEFINE_NAME_STRING(OutputStreamPointer)	//!< std::ostream *<br />
CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode)	//!< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters)	//!< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters)	//!< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(Separator)			//< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(Terminator)			//< ConstByteArrayParameter<br />
CRYPTOPP_DEFINE_NAME_STRING(Uppercase)			//< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(GroupSize)			//< int<br />
CRYPTOPP_DEFINE_NAME_STRING(Pad)				//< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(PaddingByte)		//< byte<br />
CRYPTOPP_DEFINE_NAME_STRING(Log2Base)			//< int<br />
CRYPTOPP_DEFINE_NAME_STRING(EncodingLookupArray)	//< const byte *<br />
CRYPTOPP_DEFINE_NAME_STRING(DecodingLookupArray)	//< const byte *<br />
CRYPTOPP_DEFINE_NAME_STRING(InsertLineBreaks)	//< bool<br />
CRYPTOPP_DEFINE_NAME_STRING(MaxLineLength)		//< int<br />
CRYPTOPP_DEFINE_NAME_STRING(DigestSize)			//!< int, in bytes<br />
CRYPTOPP_DEFINE_NAME_STRING(L1KeyLength)		//!< int, in bytes<br />
<br />
DOCUMENTED_NAMESPACE_END<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />


aes.h
#ifndef CRYPTOPP_AES_H<br />
#define CRYPTOPP_AES_H<br />
<br />
#include "rijndael.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
//! AES winner, announced on 10/2/2000<br />
DOCUMENTED_TYPEDEF(Rijndael, AES);<br />
<br />
typedef RijndaelEncryption AESEncryption;<br />
typedef RijndaelDecryption AESDecryption;<br />
<br />
NAMESPACE_END<br />
<br />
#endif




basecode.h
#ifndef CRYPTOPP_BASECODE_H<br />
#define CRYPTOPP_BASECODE_H<br />
<br />
#include "filters.h"<br />
#include "algparam.h"<br />
#include "argnames.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
//! base n encoder, where n is a power of 2<br />
class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter><br />
{<br />
public:<br />
	BaseN_Encoder(BufferedTransformation *attachment=NULL)<br />
		{Detach(attachment);}<br />
<br />
	BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)<br />
	{<br />
		Detach(attachment);<br />
		IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)<br />
			(Name::Log2Base(), log2base)<br />
			(Name::Pad(), padding != -1)<br />
			(Name::PaddingByte(), byte(padding)));<br />
	}<br />
<br />
	void IsolatedInitialize(const NameValuePairs &parameters);<br />
	size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
	const byte *m_alphabet;<br />
	int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
	int m_bytePos, m_bitPos;<br />
	SecByteBlock m_outBuf;<br />
};<br />
<br />
//! base n decoder, where n is a power of 2<br />
class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter><br />
{<br />
public:<br />
	BaseN_Decoder(BufferedTransformation *attachment=NULL)<br />
		{Detach(attachment);}<br />
<br />
	BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)<br />
	{<br />
		Detach(attachment);<br />
		IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));<br />
	}<br />
<br />
	void IsolatedInitialize(const NameValuePairs &parameters);<br />
	size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
	static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);<br />
<br />
private:<br />
	const int *m_lookup;<br />
	int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
	int m_bytePos, m_bitPos;<br />
	SecByteBlock m_outBuf;<br />
};<br />
<br />
//! filter that breaks input stream into groups of fixed size<br />
class CRYPTOPP_DLL Grouper : public Bufferless<Filter><br />
{<br />
public:<br />
	Grouper(BufferedTransformation *attachment=NULL)<br />
		{Detach(attachment);}<br />
<br />
	Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)<br />
	{<br />
		Detach(attachment);<br />
		IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)<br />
			(Name::Separator(), ConstByteArrayParameter(separator))<br />
			(Name::Terminator(), ConstByteArrayParameter(terminator)));<br />
	}<br />
<br />
	void IsolatedInitialize(const NameValuePairs &parameters);<br />
	size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
	SecByteBlock m_separator, m_terminator;<br />
	size_t m_groupSize, m_counter;<br />
};<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />



and a cpp
algparam.cpp
// algparam.cpp - written and placed in the public domain by Wei Dai<br />
<br />
#include "pch.h"<br />
<br />
#ifndef CRYPTOPP_IMPORTS<br />
<br />
#include "algparam.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
PAssignIntToInteger g_pAssignIntToInteger = NULL;<br />
<br />
bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
	if (strcmp(name, "ValueNames") == 0)<br />
		return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);<br />
	else<br />
		return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
	if (strcmp(name, "ValueNames") == 0)<br />
	{<br />
		ThrowIfTypeMismatch(name, typeid(std::string), valueType);<br />
		GetParent().GetVoidValue(name, valueType, pValue);<br />
		(*reinterpret_cast<std::string *>(pValue) += m_name) += ";";<br />
		return true;<br />
	}<br />
	else if (strcmp(name, m_name) == 0)<br />
	{<br />
		AssignValue(name, valueType, pValue);<br />
		m_used = true;<br />
		return true;<br />
	}<br />
	else<br />
		return GetParent().GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
NAMESPACE_END<br />
<br />
#endif

GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
Mark Salsbery1-Apr-08 8:42
Mark Salsbery1-Apr-08 8:42 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
pabloraul1-Apr-08 8:44
pabloraul1-Apr-08 8:44 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
Mark Salsbery1-Apr-08 9:14
Mark Salsbery1-Apr-08 9:14 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
pabloraul1-Apr-08 9:28
pabloraul1-Apr-08 9:28 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
led mike1-Apr-08 8:54
led mike1-Apr-08 8:54 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
led mike1-Apr-08 7:48
led mike1-Apr-08 7:48 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
Nemanja Trifunovic1-Apr-08 9:08
Nemanja Trifunovic1-Apr-08 9:08 
GeneralRe: How to use Namespaces created in different projects in the same solution? Pin
led mike1-Apr-08 9:40
led mike1-Apr-08 9:40 
Questionwhat is the difference in winInet functions and sockets for connecting to ftp servers Pin
Jach Mullan1-Apr-08 3:55
Jach Mullan1-Apr-08 3:55 
GeneralRe: what is the difference in winInet functions and sockets for connecting to ftp servers Pin
led mike1-Apr-08 4:21
led mike1-Apr-08 4:21 
GeneralRe: what is the difference in winInet functions and sockets for connecting to ftp servers Pin
Mark Salsbery1-Apr-08 6:09
Mark Salsbery1-Apr-08 6:09 
GeneralRe: what is the difference in winInet functions and sockets for connecting to ftp servers Pin
ThatsAlok1-Apr-08 9:23
ThatsAlok1-Apr-08 9:23 
QuestionIs it possible to construct a screen which can display the points of x, y and z axis by inputing 3 txt files by c++? Pin
johndoelee1-Apr-08 3:26
johndoelee1-Apr-08 3:26 
GeneralRe: Is it possible to construct a screen which can display the points of x, y and z axis by inputing 3 txt files by c++? Pin
Iain Clarke, Warrior Programmer1-Apr-08 3:57
Iain Clarke, Warrior Programmer1-Apr-08 3:57 
GeneralRe: Is it possible to construct a screen which can display the points of x, y and z axis by inputing 3 txt files by c++? Pin
Cedric Moonen1-Apr-08 4:08
Cedric Moonen1-Apr-08 4:08 
GeneralRe: Is it possible to construct a screen which can display the points of x, y and z axis by inputing 3 txt files by c++? Pin
CPallini1-Apr-08 4:14
mveCPallini1-Apr-08 4:14 
QuestionRe: Is it possible to construct a screen which can display the points of x, y and z axis by inputing 3 txt files by c++? [modified] Pin
johndoelee1-Apr-08 4:58
johndoelee1-Apr-08 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.