#include <vector>
#include "vmac.h"
using namespace std;
void TestVMac( int _num, vector<uint64> *_res )
{
const char key[16] = "somedummykey345";
const byte pattern[100] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
if ( sizeof(pattern) < _num )
_num = sizeof(pattern);
const uint64 nonce[2] = { 0x10, 0x0 };
CryptoPP::VMAC<CryptoPP::AES, 64> hasher;
hasher.SetKey( (byte*)key, 16, CryptoPP::MakeParameters
( CryptoPP::Name::IV(), (const byte*)&nonce, false )
( CryptoPP::Name::KeySize(), 128 ) );
_res->clear();
for ( size_t i = 1, e = _num; i != e; ++ i )
{
uint64 cv;
hasher.Resynchronize( (const byte*)nonce );
hasher.CalculateDigest( (byte*)&cv, pattern, i );
_res->push_back( cv );
}
}
int main(int argc, char *argv[])
{
return a.exec();
}
#include <vector>
#include "vmac.h"
using namespace std;
void TestVMac( int _num, vector<uint64> *_res )
{
const char key[16] = "somedummykey345";
const byte pattern[100] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
if ( sizeof(pattern) < _num )
_num = sizeof(pattern);
const uint64 nonce[2] = { 0x10, 0x0 };
CryptoPP::VMAC<CryptoPP::AES, 64> hasher;
hasher.SetKey( (byte*)key, 16, CryptoPP::MakeParameters
( CryptoPP::Name::IV(), (const byte*)&nonce, false )
( CryptoPP::Name::KeySize(), 128 ) );
_res->clear();
for ( size_t i = 1, e = _num; i != e; ++ i )
{
uint64 cv;
hasher.Resynchronize( (const byte*)nonce );
hasher.CalculateDigest( (byte*)&cv, pattern, i );
_res->push_back( cv );
}
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks