mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-11-21 19:27:09 +01:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
1 parent
e0e34b4030
commit
4a6bfc086c
6219 files changed
+1209835
-454916
No files matched your search
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// HMACEngineTest.cpp
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "HMACEngineTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/HMACEngine.h"
|
||||
#include "Poco/MD5Engine.h"
|
||||
|
||||
|
||||
using Poco::HMACEngine;
|
||||
using Poco::MD5Engine;
|
||||
using Poco::DigestEngine;
|
||||
|
||||
|
||||
HMACEngineTest::HMACEngineTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HMACEngineTest::~HMACEngineTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void HMACEngineTest::testHMAC()
|
||||
{
|
||||
// test vectors from RFC 2104
|
||||
|
||||
std::string key(16, 0x0b);
|
||||
std::string data("Hi There");
|
||||
HMACEngine<MD5Engine> hmac1(key);
|
||||
hmac1.update(data);
|
||||
std::string digest = DigestEngine::digestToHex(hmac1.digest());
|
||||
assertTrue (digest == "9294727a3638bb1c13f48ef8158bfc9d");
|
||||
|
||||
key = "Jefe";
|
||||
data = "what do ya want for nothing?";
|
||||
HMACEngine<MD5Engine> hmac2(key);
|
||||
hmac2.update(data);
|
||||
digest = DigestEngine::digestToHex(hmac2.digest());
|
||||
assertTrue (digest == "750c783e6ab0b503eaa86e310a5db738");
|
||||
|
||||
key = std::string(16, std::string::value_type(0xaa));
|
||||
data = std::string(50, std::string::value_type(0xdd));
|
||||
HMACEngine<MD5Engine> hmac3(key);
|
||||
hmac3.update(data);
|
||||
digest = DigestEngine::digestToHex(hmac3.digest());
|
||||
assertTrue (digest == "56be34521d144c88dbb8c733f0e8b3f6");
|
||||
}
|
||||
|
||||
|
||||
void HMACEngineTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void HMACEngineTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* HMACEngineTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("HMACEngineTest");
|
||||
|
||||
CppUnit_addTest(pSuite, HMACEngineTest, testHMAC);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
Reference in new issue
Block a user