misc changes
parent
b3d4024665
commit
5b2008101c
|
|
@ -264,4 +264,6 @@ History
|
||||||
|
|
||||||
5.2 - Merged in changes for 5.01 - 5.0.4
|
5.2 - Merged in changes for 5.01 - 5.0.4
|
||||||
- added support for using encoding parameters and key derivation parameters
|
- added support for using encoding parameters and key derivation parameters
|
||||||
with public key encryption (implemented by OAEP and DLIES)
|
with public key encryption (implemented by OAEP and DL/ECIES)
|
||||||
|
- added Camellia, SHACAL-2, Two-Track-MAC, Whirlpool, RIPEMD-320,
|
||||||
|
RIPEMD-128, RIPEMD-256, Base 32 coding
|
||||||
|
|
|
||||||
14
algparam.h
14
algparam.h
|
|
@ -67,7 +67,7 @@ private:
|
||||||
unsigned int m_size;
|
unsigned int m_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CombinedNameValuePairs : public NameValuePairs
|
class CRYPTOPP_DLL CombinedNameValuePairs : public NameValuePairs
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CombinedNameValuePairs(const NameValuePairs &pairs1, const NameValuePairs &pairs2)
|
CombinedNameValuePairs(const NameValuePairs &pairs1, const NameValuePairs &pairs2)
|
||||||
|
|
@ -323,6 +323,12 @@ public:
|
||||||
return AlgorithmParameters<AlgorithmParameters<PARENT,T>, R>(*this, name, value, m_throwIfNotUsed);
|
return AlgorithmParameters<AlgorithmParameters<PARENT,T>, R>(*this, name, value, m_throwIfNotUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class R>
|
||||||
|
AlgorithmParameters<AlgorithmParameters<PARENT,T>, R> operator()(const char *name, const R &value, bool throwIfNotUsed) const
|
||||||
|
{
|
||||||
|
return AlgorithmParameters<AlgorithmParameters<PARENT,T>, R>(*this, name, value, throwIfNotUsed);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NameValuePairs & GetParent() const {return m_parent;}
|
const NameValuePairs & GetParent() const {return m_parent;}
|
||||||
PARENT m_parent;
|
PARENT m_parent;
|
||||||
|
|
@ -331,7 +337,11 @@ private:
|
||||||
//! Create an object that implements NameValuePairs for passing parameters
|
//! Create an object that implements NameValuePairs for passing parameters
|
||||||
/*! \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed
|
/*! \param throwIfNotUsed if true, the object will throw an exception if the value is not accessed
|
||||||
\note throwIfNotUsed is ignored if using a compiler that does not support std::uncaught_exception(),
|
\note throwIfNotUsed is ignored if using a compiler that does not support std::uncaught_exception(),
|
||||||
such as MSVC 7.0 and earlier. */
|
such as MSVC 7.0 and earlier.
|
||||||
|
\note A NameValuePairs object containing an arbitrary number of name value pairs may be constructed by
|
||||||
|
repeatedly using operator() on the object returned by MakeParameters, for example:
|
||||||
|
const NameValuePairs ¶meters = MakeParameters(name1, value1)(name2, value2)(name3, value3);
|
||||||
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
AlgorithmParameters<NullNameValuePairs,T> MakeParameters(const char *name, const T &value, bool throwIfNotUsed = true)
|
AlgorithmParameters<NullNameValuePairs,T> MakeParameters(const char *name, const T &value, bool throwIfNotUsed = true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
11
argnames.h
11
argnames.h
|
|
@ -55,6 +55,17 @@ CRYPTOPP_DEFINE_NAME_STRING(OutputStreamPointer) //!< std::ostream *
|
||||||
CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode) //!< bool
|
CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode) //!< bool
|
||||||
CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters) //!< ConstByteArrayParameter
|
CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters) //!< ConstByteArrayParameter
|
||||||
CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters) //!< ConstByteArrayParameter
|
CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters) //!< ConstByteArrayParameter
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(Separator) //< ConstByteArrayParameter
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(Terminator) //< ConstByteArrayParameter
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(Uppercase) //< bool
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(GroupSize) //< int
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(Pad) //< bool
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(PaddingByte) //< byte
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(Log2Base) //< int
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(EncodingLookupArray) //< const byte *
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(DecodingLookupArray) //< const byte *
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(InsertLineBreaks) //< bool
|
||||||
|
CRYPTOPP_DEFINE_NAME_STRING(MaxLineLength) //< int
|
||||||
|
|
||||||
DOCUMENTED_NAMESPACE_END
|
DOCUMENTED_NAMESPACE_END
|
||||||
|
|
||||||
|
|
|
||||||
16
base64.cpp
16
base64.cpp
|
|
@ -11,19 +11,19 @@ static const byte s_padding = '=';
|
||||||
|
|
||||||
void Base64Encoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
void Base64Encoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
{
|
{
|
||||||
bool insertLineBreaks = parameters.GetValueWithDefault("InsertLineBreaks", true);
|
bool insertLineBreaks = parameters.GetValueWithDefault(Name::InsertLineBreaks(), true);
|
||||||
int maxLineLength = parameters.GetIntValueWithDefault("MaxLineLength", 72);
|
int maxLineLength = parameters.GetIntValueWithDefault(Name::MaxLineLength(), 72);
|
||||||
|
|
||||||
const char *lineBreak = insertLineBreaks ? "\n" : "";
|
const char *lineBreak = insertLineBreaks ? "\n" : "";
|
||||||
|
|
||||||
m_filter->Initialize(CombinedNameValuePairs(
|
m_filter->Initialize(CombinedNameValuePairs(
|
||||||
parameters,
|
parameters,
|
||||||
MakeParameters("EncodingLookupArray", (const byte *)s_vec)
|
MakeParameters(Name::EncodingLookupArray(), &s_vec[0], false)
|
||||||
("PaddingByte", s_padding)
|
(Name::PaddingByte(), s_padding)
|
||||||
("Log2Base", 6)
|
(Name::GroupSize(), insertLineBreaks ? maxLineLength : 0)
|
||||||
("GroupSize", insertLineBreaks ? maxLineLength : 0)
|
(Name::Separator(), ConstByteArrayParameter(lineBreak))
|
||||||
("Separator", ConstByteArrayParameter(lineBreak))
|
(Name::Terminator(), ConstByteArrayParameter(lineBreak))
|
||||||
("Terminator", ConstByteArrayParameter(lineBreak))));
|
(Name::Log2Base(), 6, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int *Base64Decoder::GetDecodingLookupArray()
|
const int *Base64Decoder::GetDecodingLookupArray()
|
||||||
|
|
|
||||||
2
base64.h
2
base64.h
|
|
@ -12,7 +12,7 @@ public:
|
||||||
Base64Encoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = true, int maxLineLength = 72)
|
Base64Encoder(BufferedTransformation *attachment = NULL, bool insertLineBreaks = true, int maxLineLength = 72)
|
||||||
: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
|
: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
|
||||||
{
|
{
|
||||||
IsolatedInitialize(MakeParameters("InsertLineBreaks", insertLineBreaks)("MaxLineLength", maxLineLength));
|
IsolatedInitialize(MakeParameters(Name::InsertLineBreaks(), insertLineBreaks)(Name::MaxLineLength(), maxLineLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
|
||||||
20
basecode.cpp
20
basecode.cpp
|
|
@ -12,16 +12,16 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
void BaseN_Encoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
void BaseN_Encoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
{
|
{
|
||||||
parameters.GetRequiredParameter("BaseN_Encoder", "EncodingLookupArray", m_alphabet);
|
parameters.GetRequiredParameter("BaseN_Encoder", Name::EncodingLookupArray(), m_alphabet);
|
||||||
|
|
||||||
parameters.GetRequiredIntParameter("BaseN_Encoder", "Log2Base", m_bitsPerChar);
|
parameters.GetRequiredIntParameter("BaseN_Encoder", Name::Log2Base(), m_bitsPerChar);
|
||||||
if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8)
|
if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8)
|
||||||
throw InvalidArgument("BaseN_Encoder: Log2Base must be between 1 and 7 inclusive");
|
throw InvalidArgument("BaseN_Encoder: Log2Base must be between 1 and 7 inclusive");
|
||||||
|
|
||||||
byte padding;
|
byte padding;
|
||||||
bool pad;
|
bool pad;
|
||||||
if (parameters.GetValue("PaddingByte", padding))
|
if (parameters.GetValue(Name::PaddingByte(), padding))
|
||||||
pad = parameters.GetValueWithDefault("Pad", true);
|
pad = parameters.GetValueWithDefault(Name::Pad(), true);
|
||||||
else
|
else
|
||||||
pad = false;
|
pad = false;
|
||||||
m_padding = pad ? padding : -1;
|
m_padding = pad ? padding : -1;
|
||||||
|
|
@ -105,9 +105,9 @@ unsigned int BaseN_Encoder::Put2(const byte *begin, unsigned int length, int mes
|
||||||
|
|
||||||
void BaseN_Decoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
void BaseN_Decoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
{
|
{
|
||||||
parameters.GetRequiredParameter("BaseN_Decoder", "DecodingLookupArray", m_lookup);
|
parameters.GetRequiredParameter("BaseN_Decoder", Name::DecodingLookupArray(), m_lookup);
|
||||||
|
|
||||||
parameters.GetRequiredIntParameter("BaseN_Decoder", "Log2Base", m_bitsPerChar);
|
parameters.GetRequiredIntParameter("BaseN_Decoder", Name::Log2Base(), m_bitsPerChar);
|
||||||
if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8)
|
if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8)
|
||||||
throw InvalidArgument("BaseN_Decoder: Log2Base must be between 1 and 7 inclusive");
|
throw InvalidArgument("BaseN_Decoder: Log2Base must be between 1 and 7 inclusive");
|
||||||
|
|
||||||
|
|
@ -189,13 +189,13 @@ void BaseN_Decoder::InitializeDecodingLookupArray(int *lookup, const byte *alpha
|
||||||
|
|
||||||
void Grouper::IsolatedInitialize(const NameValuePairs ¶meters)
|
void Grouper::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
{
|
{
|
||||||
m_groupSize = parameters.GetIntValueWithDefault("GroupSize", 0);
|
m_groupSize = parameters.GetIntValueWithDefault(Name::GroupSize(), 0);
|
||||||
ConstByteArrayParameter separator, terminator;
|
ConstByteArrayParameter separator, terminator;
|
||||||
if (m_groupSize)
|
if (m_groupSize)
|
||||||
parameters.GetRequiredParameter("Grouper", "Separator", separator);
|
parameters.GetRequiredParameter("Grouper", Name::Separator(), separator);
|
||||||
else
|
else
|
||||||
parameters.GetValue("Separator", separator);
|
parameters.GetValue(Name::Separator(), separator);
|
||||||
parameters.GetValue("Terminator", terminator);
|
parameters.GetValue(Name::Terminator(), terminator);
|
||||||
|
|
||||||
m_separator.Assign(separator.begin(), separator.size());
|
m_separator.Assign(separator.begin(), separator.size());
|
||||||
m_terminator.Assign(terminator.begin(), terminator.size());
|
m_terminator.Assign(terminator.begin(), terminator.size());
|
||||||
|
|
|
||||||
19
basecode.h
19
basecode.h
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
#include "algparam.h"
|
#include "algparam.h"
|
||||||
|
#include "argnames.h"
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
|
|
@ -15,10 +16,10 @@ public:
|
||||||
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)
|
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)
|
||||||
: Unflushable<Filter>(attachment)
|
: Unflushable<Filter>(attachment)
|
||||||
{
|
{
|
||||||
IsolatedInitialize(MakeParameters("EncodingLookupArray", alphabet)
|
IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)
|
||||||
("Log2Base", log2base)
|
(Name::Log2Base(), log2base)
|
||||||
("Pad", padding != -1)
|
(Name::Pad(), padding != -1)
|
||||||
("PaddingByte", byte(padding)));
|
(Name::PaddingByte(), byte(padding)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
@ -40,13 +41,13 @@ public:
|
||||||
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)
|
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)
|
||||||
: Unflushable<Filter>(attachment)
|
: Unflushable<Filter>(attachment)
|
||||||
{
|
{
|
||||||
IsolatedInitialize(MakeParameters("DecodingLookupArray", lookup)("Log2Base", log2base));
|
IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking);
|
||||||
|
|
||||||
static void InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int log2base, bool caseInsensitive);
|
static void InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int *m_lookup;
|
const int *m_lookup;
|
||||||
|
|
@ -64,9 +65,9 @@ public:
|
||||||
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)
|
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)
|
||||||
: Bufferless<Filter>(attachment)
|
: Bufferless<Filter>(attachment)
|
||||||
{
|
{
|
||||||
IsolatedInitialize(MakeParameters("GroupSize", groupSize)
|
IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)
|
||||||
("Separator", ConstByteArrayParameter(separator))
|
(Name::Separator(), ConstByteArrayParameter(separator))
|
||||||
("Terminator", ConstByteArrayParameter(terminator)));
|
(Name::Terminator(), ConstByteArrayParameter(terminator)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
|
||||||
38
bench.cpp
38
bench.cpp
|
|
@ -87,11 +87,11 @@ static const byte *const key=(byte *)"0123456789abcdefghijklmnopqrstuvwxyzABCDEF
|
||||||
static double logtotal = 0;
|
static double logtotal = 0;
|
||||||
static unsigned int logcount = 0;
|
static unsigned int logcount = 0;
|
||||||
|
|
||||||
void OutputResultBytes(const char *name, unsigned long length, double timeTaken)
|
void OutputResultBytes(const char *name, double length, double timeTaken)
|
||||||
{
|
{
|
||||||
double mbs = length / timeTaken / (1024*1024);
|
double mbs = length / timeTaken / (1024*1024);
|
||||||
cout << "<TR><TH>" << name;
|
cout << "<TR><TH>" << name;
|
||||||
cout << "<TD>" << length;
|
cout << "<TD>" << setprecision(3) << length / (1024*1024);
|
||||||
cout << setiosflags(ios::fixed);
|
cout << setiosflags(ios::fixed);
|
||||||
cout << "<TD>" << setprecision(3) << timeTaken;
|
cout << "<TD>" << setprecision(3) << timeTaken;
|
||||||
cout << "<TD>" << setprecision(3) << mbs << endl;
|
cout << "<TD>" << setprecision(3) << mbs << endl;
|
||||||
|
|
@ -120,18 +120,18 @@ void BenchMark(const char *name, BlockTransformation &cipher, double timeTotal)
|
||||||
const int nBlocks = BUF_SIZE / cipher.BlockSize();
|
const int nBlocks = BUF_SIZE / cipher.BlockSize();
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
unsigned long i=0, length=BUF_SIZE;
|
unsigned long i=0, blocks=1;
|
||||||
double timeTaken;
|
double timeTaken;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
length *= 2;
|
blocks *= 2;
|
||||||
for (; i<length; i+=BUF_SIZE)
|
for (; i<blocks; i++)
|
||||||
cipher.ProcessAndXorMultipleBlocks(buf, NULL, buf, nBlocks);
|
cipher.ProcessAndXorMultipleBlocks(buf, NULL, buf, nBlocks);
|
||||||
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
||||||
}
|
}
|
||||||
while (timeTaken < 2.0/3*timeTotal);
|
while (timeTaken < 2.0/3*timeTotal);
|
||||||
|
|
||||||
OutputResultBytes(name, length, timeTaken);
|
OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal)
|
void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal)
|
||||||
|
|
@ -140,18 +140,18 @@ void BenchMark(const char *name, StreamTransformation &cipher, double timeTotal)
|
||||||
SecByteBlock buf(BUF_SIZE);
|
SecByteBlock buf(BUF_SIZE);
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
unsigned long i=0, length=BUF_SIZE;
|
unsigned long i=0, blocks=1;
|
||||||
double timeTaken;
|
double timeTaken;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
length *= 2;
|
blocks *= 2;
|
||||||
for (; i<length; i+=BUF_SIZE)
|
for (; i<blocks; i++)
|
||||||
cipher.ProcessString(buf, BUF_SIZE);
|
cipher.ProcessString(buf, BUF_SIZE);
|
||||||
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
||||||
}
|
}
|
||||||
while (timeTaken < 2.0/3*timeTotal);
|
while (timeTaken < 2.0/3*timeTotal);
|
||||||
|
|
||||||
OutputResultBytes(name, length, timeTaken);
|
OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BenchMark(const char *name, HashTransformation &hash, double timeTotal)
|
void BenchMark(const char *name, HashTransformation &hash, double timeTotal)
|
||||||
|
|
@ -162,18 +162,18 @@ void BenchMark(const char *name, HashTransformation &hash, double timeTotal)
|
||||||
rng.GenerateBlock(buf, BUF_SIZE);
|
rng.GenerateBlock(buf, BUF_SIZE);
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
unsigned long i=0, length=BUF_SIZE;
|
unsigned long i=0, blocks=1;
|
||||||
double timeTaken;
|
double timeTaken;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
length *= 2;
|
blocks *= 2;
|
||||||
for (; i<length; i+=BUF_SIZE)
|
for (; i<blocks; i++)
|
||||||
hash.Update(buf, BUF_SIZE);
|
hash.Update(buf, BUF_SIZE);
|
||||||
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
||||||
}
|
}
|
||||||
while (timeTaken < 2.0/3*timeTotal);
|
while (timeTaken < 2.0/3*timeTotal);
|
||||||
|
|
||||||
OutputResultBytes(name, length, timeTaken);
|
OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BenchMark(const char *name, BufferedTransformation &bt, double timeTotal)
|
void BenchMark(const char *name, BufferedTransformation &bt, double timeTotal)
|
||||||
|
|
@ -184,18 +184,18 @@ void BenchMark(const char *name, BufferedTransformation &bt, double timeTotal)
|
||||||
rng.GenerateBlock(buf, BUF_SIZE);
|
rng.GenerateBlock(buf, BUF_SIZE);
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
unsigned long i=0, length=BUF_SIZE;
|
unsigned long i=0, blocks=1;
|
||||||
double timeTaken;
|
double timeTaken;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
length *= 2;
|
blocks *= 2;
|
||||||
for (; i<length; i+=BUF_SIZE)
|
for (; i<blocks; i++)
|
||||||
bt.Put(buf, BUF_SIZE);
|
bt.Put(buf, BUF_SIZE);
|
||||||
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND;
|
||||||
}
|
}
|
||||||
while (timeTaken < 2.0/3*timeTotal);
|
while (timeTaken < 2.0/3*timeTotal);
|
||||||
|
|
||||||
OutputResultBytes(name, length, timeTaken);
|
OutputResultBytes(name, double(blocks) * BUF_SIZE, timeTaken);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
|
void BenchMarkEncryption(const char *name, PK_Encryptor &key, double timeTotal, bool pc=false)
|
||||||
|
|
@ -434,7 +434,7 @@ void BenchMarkAll(double t)
|
||||||
logcount = 0;
|
logcount = 0;
|
||||||
|
|
||||||
cout << "<TABLE border=1><COLGROUP><COL align=left><COL align=right><COL align=right><COL align=right>" << endl;
|
cout << "<TABLE border=1><COLGROUP><COL align=left><COL align=right><COL align=right><COL align=right>" << endl;
|
||||||
cout << "<THEAD><TR><TH>Algorithm<TH>Bytes Processed<TH>Time Taken<TH>Megabytes(2^20 bytes)/Second\n<TBODY>" << endl;
|
cout << "<THEAD><TR><TH>Algorithm<TH>Megabytes(2^20 bytes) Processed<TH>Time Taken<TH>MB/Second\n<TBODY>" << endl;
|
||||||
|
|
||||||
BenchMarkKeyless<CRC32>("CRC-32", t);
|
BenchMarkKeyless<CRC32>("CRC-32", t);
|
||||||
BenchMarkKeyless<Adler32>("Adler-32", t);
|
BenchMarkKeyless<Adler32>("Adler-32", t);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRYPTDLL_EXPORTS" /YX /FD /c
|
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRYPTDLL_EXPORTS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRYPTOPP_EXPORTS" /D CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2=1 /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /Zm200 /c
|
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CRYPTOPP_EXPORTS" /D CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2=1 /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /Zm200 /c
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
|
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||||
# ADD LINK32 advapi32.lib /nologo /base:"0x42900000" /dll /debug /machine:I386 /out:"DLL_Release/cryptopp.dll" /opt:ref /export:CryptoPP_Malloc=malloc /export:CryptoPP_Free=free
|
# ADD LINK32 advapi32.lib /nologo /base:"0x42900000" /dll /map /debug /machine:I386 /out:"DLL_Release/cryptopp.dll" /opt:ref /export:CryptoPP_Malloc=malloc /export:CryptoPP_Free=free
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
# Begin Custom Build
|
# Begin Custom Build
|
||||||
OutDir=.\DLL_Release
|
OutDir=.\DLL_Release
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
||||||
# ADD CPP /nologo /G5 /Gz /MD /W3 /GX /Zi /O2 /D "NDEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -75,7 +75,7 @@ PreLink_Cmds=echo This configuration requires cryptopp.dll. echo You can build i
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm200 /c
|
||||||
# ADD CPP /nologo /G5 /Gz /MDd /W3 /GX /ZI /Od /D "_DEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "CRYPTOPP_IMPORTS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /Zm400 /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -103,7 +103,7 @@ PreLink_Cmds=echo This configuration requires cryptopp.dll. echo You can build i
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /Zm400 /c
|
# ADD CPP /nologo /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /YX /FD /Zm400 /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -111,7 +111,7 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /OPT:NOWIN98 /OPT:REF /OPT:ICF
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /subsystem:console /map /debug /machine:I386 /OPT:NOWIN98 /OPT:REF /OPT:ICF
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "cryptest - Win32 Debug"
|
!ELSEIF "$(CFG)" == "cryptest - Win32 Debug"
|
||||||
|
|
|
||||||
|
|
@ -359,12 +359,12 @@ unsigned int BufferedTransformation::TransferMessagesTo2(BufferedTransformation
|
||||||
for (messageCount=0; messageCount < maxMessages && AnyMessages(); messageCount++)
|
for (messageCount=0; messageCount < maxMessages && AnyMessages(); messageCount++)
|
||||||
{
|
{
|
||||||
unsigned int blockedBytes;
|
unsigned int blockedBytes;
|
||||||
unsigned long transferedBytes;
|
unsigned long transferredBytes;
|
||||||
|
|
||||||
while (AnyRetrievable())
|
while (AnyRetrievable())
|
||||||
{
|
{
|
||||||
transferedBytes = ULONG_MAX;
|
transferredBytes = ULONG_MAX;
|
||||||
blockedBytes = TransferTo2(target, transferedBytes, channel, blocking);
|
blockedBytes = TransferTo2(target, transferredBytes, channel, blocking);
|
||||||
if (blockedBytes > 0)
|
if (blockedBytes > 0)
|
||||||
return blockedBytes;
|
return blockedBytes;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
cryptlib.dsp
14
cryptlib.dsp
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
||||||
# PROP Intermediate_Dir "FIPS_140_Release"
|
# PROP Intermediate_Dir "FIPS_140_Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
||||||
# ADD CPP /nologo /G5 /Gz /MD /W3 /GX /Zi /O2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Release/cryptopp" /FD /c
|
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Release/cryptopp" /FD /c
|
||||||
# ADD BASE RSC /l 0x409
|
# ADD BASE RSC /l 0x409
|
||||||
# ADD RSC /l 0x409
|
# ADD RSC /l 0x409
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -66,7 +66,7 @@ LIB32=link.exe -lib
|
||||||
# PROP Intermediate_Dir "FIPS_140_Debug"
|
# PROP Intermediate_Dir "FIPS_140_Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
|
||||||
# ADD CPP /nologo /G5 /Gz /MDd /W3 /GX /ZI /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Debug/cryptopp" /FD /c
|
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /Fd"FIPS_140_Debug/cryptopp" /FD /c
|
||||||
# ADD BASE RSC /l 0x409
|
# ADD BASE RSC /l 0x409
|
||||||
# ADD RSC /l 0x409
|
# ADD RSC /l 0x409
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -89,7 +89,7 @@ LIB32=link.exe -lib
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
|
# ADD CPP /nologo /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
|
||||||
# ADD BASE RSC /l 0x409
|
# ADD BASE RSC /l 0x409
|
||||||
# ADD RSC /l 0x409
|
# ADD RSC /l 0x409
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -210,6 +210,10 @@ SOURCE=.\asn.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\base32.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\base64.cpp
|
SOURCE=.\base64.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
@ -680,6 +684,10 @@ SOURCE=.\asn.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\base32.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\base64.h
|
SOURCE=.\base64.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,11 @@ struct CRYPTOPP_DLL DecodingResult
|
||||||
};
|
};
|
||||||
|
|
||||||
//! interface for retrieving values given their names
|
//! interface for retrieving values given their names
|
||||||
/*! This class is used to safely pass a variable number of arbitrarily typed arguments to functions
|
/*! \note This class is used to safely pass a variable number of arbitrarily typed arguments to functions
|
||||||
and to read values from keys and crypto parameters.
|
and to read values from keys and crypto parameters.
|
||||||
To get a value, you need to know the name and the type of the value.
|
\note To obtain an object that implements NameValuePairs for the purpose of parameter
|
||||||
|
passing, use the MakeParameters() function.
|
||||||
|
\note To get a value from NameValuePairs, you need to know the name and the type of the value.
|
||||||
Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports.
|
Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports.
|
||||||
Then look at the Name namespace documentation to see what the type of each value is, or
|
Then look at the Name namespace documentation to see what the type of each value is, or
|
||||||
alternatively, call GetIntValue() with the value name, and if the type is not int, a
|
alternatively, call GetIntValue() with the value name, and if the type is not int, a
|
||||||
|
|
@ -779,7 +781,7 @@ public:
|
||||||
/*! There should be a MessageEnd immediately before MessageSeriesEnd. */
|
/*! There should be a MessageEnd immediately before MessageSeriesEnd. */
|
||||||
virtual bool MessageSeriesEnd(int propagation=-1, bool blocking=true);
|
virtual bool MessageSeriesEnd(int propagation=-1, bool blocking=true);
|
||||||
|
|
||||||
//! set propagation of automatically generated and transfered signals
|
//! set propagation of automatically generated and transferred signals
|
||||||
/*! propagation == 0 means do not automaticly generate signals */
|
/*! propagation == 0 means do not automaticly generate signals */
|
||||||
virtual void SetAutoSignalPropagation(int propagation) {}
|
virtual void SetAutoSignalPropagation(int propagation) {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
static const TestData *s_currentTestData = NULL;
|
static const TestData *s_currentTestData = NULL;
|
||||||
|
|
||||||
void OutputTestData(const TestData &v)
|
static void OutputTestData(const TestData &v)
|
||||||
{
|
{
|
||||||
for (TestData::const_iterator i = v.begin(); i != v.end(); ++i)
|
for (TestData::const_iterator i = v.begin(); i != v.end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -32,13 +32,13 @@ void OutputTestData(const TestData &v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTestFailure()
|
static void SignalTestFailure()
|
||||||
{
|
{
|
||||||
OutputTestData(*s_currentTestData);
|
OutputTestData(*s_currentTestData);
|
||||||
throw TestFailure();
|
throw TestFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalTestError()
|
static void SignalTestError()
|
||||||
{
|
{
|
||||||
OutputTestData(*s_currentTestData);
|
OutputTestData(*s_currentTestData);
|
||||||
throw Exception(Exception::OTHER_ERROR, "Unexpected error during validation test");
|
throw Exception(Exception::OTHER_ERROR, "Unexpected error during validation test");
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /c
|
# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
@ -50,7 +50,7 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"DLL_Release/dlltest.exe" /libpath:"DLL_Release"
|
# ADD LINK32 /nologo /subsystem:console /map /debug /machine:I386 /out:"DLL_Release/dlltest.exe" /libpath:"DLL_Release"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "dlltest - Win32 Debug"
|
!ELSEIF "$(CFG)" == "dlltest - Win32 Debug"
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ LINK32=link.exe
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /GZ /c
|
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CRYPTOPP_DLL_ONLY" /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
|
||||||
13
hex.cpp
13
hex.cpp
|
|
@ -13,13 +13,20 @@ static const byte s_vecLower[] = "0123456789abcdef";
|
||||||
|
|
||||||
void HexEncoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
void HexEncoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
{
|
{
|
||||||
bool uppercase = parameters.GetValueWithDefault("Uppercase", true);
|
bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
|
||||||
m_filter->Initialize(CombinedNameValuePairs(
|
m_filter->Initialize(CombinedNameValuePairs(
|
||||||
parameters,
|
parameters,
|
||||||
MakeParameters("EncodingLookupArray", uppercase ? &s_vecUpper[0] : &s_vecLower[0])("Log2Base", 4)));
|
MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int *HexDecoder::GetDecodingLookupArray()
|
void HexDecoder::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||||
|
{
|
||||||
|
BaseN_Decoder::Initialize(CombinedNameValuePairs(
|
||||||
|
parameters,
|
||||||
|
MakeParameters(Name::DecodingLookupArray(), GetDefaultDecodingLookupArray(), false)(Name::Log2Base(), 4, true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const int *HexDecoder::GetDefaultDecodingLookupArray()
|
||||||
{
|
{
|
||||||
static bool s_initialized = false;
|
static bool s_initialized = false;
|
||||||
static int s_array[256];
|
static int s_array[256];
|
||||||
|
|
|
||||||
8
hex.h
8
hex.h
|
|
@ -12,7 +12,7 @@ public:
|
||||||
HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
|
HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
|
||||||
: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
|
: SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
|
||||||
{
|
{
|
||||||
IsolatedInitialize(MakeParameters("Uppercase", uppercase)("GroupSize", outputGroupSize)("Separator", ConstByteArrayParameter(separator)));
|
IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters);
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
@ -23,12 +23,12 @@ class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HexDecoder(BufferedTransformation *attachment = NULL)
|
HexDecoder(BufferedTransformation *attachment = NULL)
|
||||||
: BaseN_Decoder(GetDecodingLookupArray(), 4, attachment) {}
|
: BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {}
|
||||||
|
|
||||||
void IsolatedInitialize(const NameValuePairs ¶meters) {}
|
void IsolatedInitialize(const NameValuePairs ¶meters);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int *GetDecodingLookupArray();
|
static const int *GetDefaultDecodingLookupArray();
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
15
modes.h
15
modes.h
|
|
@ -275,19 +275,26 @@ template <class BASE>
|
||||||
class CipherModeFinalTemplate_ExternalCipher : public BASE
|
class CipherModeFinalTemplate_ExternalCipher : public BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher);
|
CipherModeFinalTemplate_ExternalCipher() {}
|
||||||
|
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher)
|
||||||
|
{SetCipher(cipher);}
|
||||||
|
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0)
|
||||||
|
{SetCipherWithIV(cipher, iv, feedbackSize);}
|
||||||
|
|
||||||
CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize = 0);
|
void SetCipher(BlockCipher &cipher);
|
||||||
|
void SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BASE> CipherModeFinalTemplate_ExternalCipher<BASE>::CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher)
|
template <class BASE>
|
||||||
|
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipher(BlockCipher &cipher)
|
||||||
{
|
{
|
||||||
ThrowIfResynchronizable();
|
ThrowIfResynchronizable();
|
||||||
m_cipher = &cipher;
|
m_cipher = &cipher;
|
||||||
ResizeBuffers();
|
ResizeBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class BASE> CipherModeFinalTemplate_ExternalCipher<BASE>::CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv, int feedbackSize)
|
template <class BASE>
|
||||||
|
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize)
|
||||||
{
|
{
|
||||||
ThrowIfInvalidIV(iv);
|
ThrowIfInvalidIV(iv);
|
||||||
m_cipher = &cipher;
|
m_cipher = &cipher;
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,14 @@ public:
|
||||||
|
|
||||||
unsigned int TimedFlush(unsigned long maxTime, unsigned int targetSize = 0);
|
unsigned int TimedFlush(unsigned long maxTime, unsigned int targetSize = 0);
|
||||||
|
|
||||||
void SetMaxBufferSize(unsigned int maxBufferSize) {m_maxBufferSize = maxBufferSize;}
|
void SetMaxBufferSize(unsigned int maxBufferSize) {m_maxBufferSize = maxBufferSize; m_buffer.SetNodeSize(STDMIN(16U*1024U+256, maxBufferSize));}
|
||||||
void SetAutoFlushBound(unsigned int bound) {m_autoFlushBound = bound;}
|
void SetAutoFlushBound(unsigned int bound) {m_autoFlushBound = bound;}
|
||||||
|
|
||||||
unsigned int GetMaxBufferSize() const {return m_maxBufferSize;}
|
unsigned int GetMaxBufferSize() const {return m_maxBufferSize;}
|
||||||
unsigned int GetCurrentBufferSize() const {return m_buffer.CurrentSize();}
|
unsigned int GetCurrentBufferSize() const {return m_buffer.CurrentSize();}
|
||||||
|
|
||||||
|
void ClearBuffer() {m_buffer.Clear();}
|
||||||
|
|
||||||
//! compute the current speed of this sink in bytes per second
|
//! compute the current speed of this sink in bytes per second
|
||||||
float ComputeCurrentSpeed();
|
float ComputeCurrentSpeed();
|
||||||
//! get the maximum observed speed of this sink in bytes per second
|
//! get the maximum observed speed of this sink in bytes per second
|
||||||
|
|
|
||||||
6
oaep.cpp
6
oaep.cpp
|
|
@ -1,8 +1,10 @@
|
||||||
// oaep.cpp - written and placed in the public domain by Wei Dai
|
// oaep.cpp - written and placed in the public domain by Wei Dai
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "oaep.h"
|
|
||||||
|
|
||||||
|
#ifndef CRYPTOPP_IMPORTS
|
||||||
|
|
||||||
|
#include "oaep.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
@ -91,3 +93,5 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, unsigned int oaepBlockLen
|
||||||
}
|
}
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
11
rsa.cpp
11
rsa.cpp
|
|
@ -12,11 +12,7 @@
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IS_DLL)
|
#if !defined(NDEBUG) && !defined(CRYPTOPP_IS_DLL)
|
||||||
#include "pssr.h"
|
#include "pssr.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_IS_DLL)
|
|
||||||
void RSA_TestInstantiations()
|
void RSA_TestInstantiations()
|
||||||
{
|
{
|
||||||
RSASS<PKCS1v15, SHA>::Verifier x1(1, 1);
|
RSASS<PKCS1v15, SHA>::Verifier x1(1, 1);
|
||||||
|
|
@ -37,10 +33,13 @@ void RSA_TestInstantiations()
|
||||||
|
|
||||||
x4 = x2.GetKey();
|
x4 = x2.GetKey();
|
||||||
}
|
}
|
||||||
|
NAMESPACE_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CRYPTOPP_IMPORTS
|
#ifndef CRYPTOPP_IMPORTS
|
||||||
|
|
||||||
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
OID RSAFunction::GetAlgorithmID() const
|
OID RSAFunction::GetAlgorithmID() const
|
||||||
{
|
{
|
||||||
return ASN1::rsaEncryption();
|
return ASN1::rsaEncryption();
|
||||||
|
|
@ -276,6 +275,6 @@ void InvertibleRSAFunction::AssignFrom(const NameValuePairs &source)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
2
stdcpp.h
2
stdcpp.h
|
|
@ -15,8 +15,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
// re-disable this
|
// re-disable this
|
||||||
|
|
|
||||||
30
test.cpp
30
test.cpp
|
|
@ -51,6 +51,8 @@ bool RSAVerifyFile(const char *pubFilename, const char *messageFilename, const c
|
||||||
void DigestFile(const char *file);
|
void DigestFile(const char *file);
|
||||||
void HmacFile(const char *hexKey, const char *file);
|
void HmacFile(const char *hexKey, const char *file);
|
||||||
|
|
||||||
|
void AES_CTR_Encrypt(const char *hexKey, const char *hexIV, const char *infile, const char *outfile);
|
||||||
|
|
||||||
string EncryptString(const char *plaintext, const char *passPhrase);
|
string EncryptString(const char *plaintext, const char *passPhrase);
|
||||||
string DecryptString(const char *ciphertext, const char *passPhrase);
|
string DecryptString(const char *ciphertext, const char *passPhrase);
|
||||||
|
|
||||||
|
|
@ -66,10 +68,10 @@ void InformationRecoverFile(int threshold, const char *outFilename, char *const
|
||||||
void GzipFile(const char *in, const char *out, int deflate_level);
|
void GzipFile(const char *in, const char *out, int deflate_level);
|
||||||
void GunzipFile(const char *in, const char *out);
|
void GunzipFile(const char *in, const char *out);
|
||||||
|
|
||||||
void Base64Encode(const char *in, const char *out);
|
void Base64Encode(const char *infile, const char *outfile);
|
||||||
void Base64Decode(const char *in, const char *out);
|
void Base64Decode(const char *infile, const char *outfile);
|
||||||
void HexEncode(const char *in, const char *out);
|
void HexEncode(const char *infile, const char *outfile);
|
||||||
void HexDecode(const char *in, const char *out);
|
void HexDecode(const char *infile, const char *outfile);
|
||||||
|
|
||||||
void ForwardTcpPort(const char *sourcePort, const char *destinationHost, const char *destinationPort);
|
void ForwardTcpPort(const char *sourcePort, const char *destinationHost, const char *destinationPort);
|
||||||
|
|
||||||
|
|
@ -291,6 +293,8 @@ int CRYPTOPP_CDECL main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else if (command == "hmac")
|
else if (command == "hmac")
|
||||||
HmacFile(argv[2], argv[3]);
|
HmacFile(argv[2], argv[3]);
|
||||||
|
else if (command == "ae")
|
||||||
|
AES_CTR_Encrypt(argv[2], argv[3], argv[4], argv[5]);
|
||||||
else if (command == "h")
|
else if (command == "h")
|
||||||
{
|
{
|
||||||
FileSource usage("usage.dat", true, new FileSink(cout));
|
FileSource usage("usage.dat", true, new FileSink(cout));
|
||||||
|
|
@ -298,7 +302,7 @@ int CRYPTOPP_CDECL main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Unrecognized command.\n";
|
cerr << "Unrecognized command. Run \"cryptest h\" to obtain usage information.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -329,6 +333,14 @@ void FIPS140_GenerateRandomFiles()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SecByteBlock HexDecodeString(const char *hex)
|
||||||
|
{
|
||||||
|
StringSource ss(hex, true, new HexDecoder);
|
||||||
|
SecByteBlock result(ss.MaxRetrievable());
|
||||||
|
ss.Get(result, result.size());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
RandomPool & GlobalRNG()
|
RandomPool & GlobalRNG()
|
||||||
{
|
{
|
||||||
static RandomPool randomPool;
|
static RandomPool randomPool;
|
||||||
|
|
@ -442,6 +454,14 @@ void HmacFile(const char *hexKey, const char *file)
|
||||||
FileSource(file, true, new HashFilter(*mac, new HexEncoder(new FileSink(cout))));
|
FileSource(file, true, new HashFilter(*mac, new HexEncoder(new FileSink(cout))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AES_CTR_Encrypt(const char *hexKey, const char *hexIV, const char *infile, const char *outfile)
|
||||||
|
{
|
||||||
|
SecByteBlock key = HexDecodeString(hexKey);
|
||||||
|
SecByteBlock iv = HexDecodeString(hexIV);
|
||||||
|
CTR_Mode<AES>::Encryption aes(key, key.size(), iv);
|
||||||
|
FileSource(infile, true, new StreamTransformationFilter(aes, new FileSink(outfile)));
|
||||||
|
}
|
||||||
|
|
||||||
string EncryptString(const char *instr, const char *passPhrase)
|
string EncryptString(const char *instr, const char *passPhrase)
|
||||||
{
|
{
|
||||||
string outstr;
|
string outstr;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ Test Driver for Crypto++(TM) Library, a C++ Class Library of Cryptographic Schem
|
||||||
- To gunzip a file
|
- To gunzip a file
|
||||||
cryptest u input output
|
cryptest u input output
|
||||||
|
|
||||||
|
- To encrypt a file with AES in CTR mode
|
||||||
|
cryptest ae input output
|
||||||
|
|
||||||
- To base64 encode a file
|
- To base64 encode a file
|
||||||
cryptest e64 input output
|
cryptest e64 input output
|
||||||
|
|
||||||
|
|
|
||||||
20
validat1.cpp
20
validat1.cpp
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
|
#include "base32.h"
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "cbcmac.h"
|
#include "cbcmac.h"
|
||||||
|
|
@ -1279,6 +1280,13 @@ bool ValidateBaseCode()
|
||||||
"A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7"
|
"A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7"
|
||||||
"C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF"
|
"C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF"
|
||||||
"F0F1F2F3F4F5F6F7F8F9FAFBFCFDFE";
|
"F0F1F2F3F4F5F6F7F8F9FAFBFCFDFE";
|
||||||
|
const char *base32Encoded =
|
||||||
|
"AAASEA2EAWDAQCAJBIFS2DIQB6IBCESVCSKTNF22DEPBYHA7D2RUAIJCENUCKJTHFAWUWK3NFWZC8NBT"
|
||||||
|
"GI3VIPJYG66DUQT5HS8V6R4AIFBEGTCFI3DWSUKKJPGE4VURKBIXEW4WKXMFQYC3MJPX2ZK8M7SGC2VD"
|
||||||
|
"NTUYN35IPFXGY5DPP3ZZA6MUQP4HK7VZRB6ZW856RX9H9AEBSKB2JBNGS8EIVCWMTUG27D6SUGJJHFEX"
|
||||||
|
"U4M3TGN4VQQJ5HW9WCS4FI7EWYVKRKFJXKX43MPQX82MDNXVYU45PP72ZG7MZRF7Z496BSQC2RCNMTYH"
|
||||||
|
"3DE6XU8N3ZHN9WGT4MJ7JXQY49NPVYY55VQ77Z9A6HTQH3HF65V8T4RK7RYQ55ZR8D29F69W8Z5RR8H3"
|
||||||
|
"9M7939R8";
|
||||||
const char *base64AndHexEncoded =
|
const char *base64AndHexEncoded =
|
||||||
"41414543417751464267634943516F4C4441304F4478415245684D554652595847426B6147787764"
|
"41414543417751464267634943516F4C4441304F4478415245684D554652595847426B6147787764"
|
||||||
"486838674953496A4A43556D4A7967704B6973734C5334764D4445794D7A51310A4E6A63344F546F"
|
"486838674953496A4A43556D4A7967704B6973734C5334764D4445794D7A51310A4E6A63344F546F"
|
||||||
|
|
@ -1290,7 +1298,7 @@ bool ValidateBaseCode()
|
||||||
"39445230745055316462580A324E6E6132397A6433742F6734654C6A354F586D352B6A7036757673"
|
"39445230745055316462580A324E6E6132397A6433742F6734654C6A354F586D352B6A7036757673"
|
||||||
"3765377638504879382F5431397666342B6672372F50332B0A";
|
"3765377638504879382F5431397666342B6672372F50332B0A";
|
||||||
|
|
||||||
cout << "\nBase64 and hex coding validation suite running...\n\n";
|
cout << "\nBase64, base32 and hex coding validation suite running...\n\n";
|
||||||
|
|
||||||
fail = !TestFilter(HexEncoder().Ref(), data, 255, (const byte *)hexEncoded, strlen(hexEncoded));
|
fail = !TestFilter(HexEncoder().Ref(), data, 255, (const byte *)hexEncoded, strlen(hexEncoded));
|
||||||
cout << (fail ? "FAILED " : "passed ");
|
cout << (fail ? "FAILED " : "passed ");
|
||||||
|
|
@ -1302,6 +1310,16 @@ bool ValidateBaseCode()
|
||||||
cout << "Hex Decoding\n";
|
cout << "Hex Decoding\n";
|
||||||
pass = pass && !fail;
|
pass = pass && !fail;
|
||||||
|
|
||||||
|
fail = !TestFilter(Base32Encoder().Ref(), data, 255, (const byte *)base32Encoded, strlen(base32Encoded));
|
||||||
|
cout << (fail ? "FAILED " : "passed ");
|
||||||
|
cout << "Base32 Encoding\n";
|
||||||
|
pass = pass && !fail;
|
||||||
|
|
||||||
|
fail = !TestFilter(Base32Decoder().Ref(), (const byte *)base32Encoded, strlen(base32Encoded), data, 255);
|
||||||
|
cout << (fail ? "FAILED " : "passed ");
|
||||||
|
cout << "Base32 Decoding\n";
|
||||||
|
pass = pass && !fail;
|
||||||
|
|
||||||
fail = !TestFilter(Base64Encoder(new HexEncoder).Ref(), data, 255, (const byte *)base64AndHexEncoded, strlen(base64AndHexEncoded));
|
fail = !TestFilter(Base64Encoder(new HexEncoder).Ref(), data, 255, (const byte *)base64AndHexEncoded, strlen(base64AndHexEncoded));
|
||||||
cout << (fail ? "FAILED " : "passed ");
|
cout << (fail ? "FAILED " : "passed ");
|
||||||
cout << "Base64 Encoding\n";
|
cout << "Base64 Encoding\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue