Hi,
I am new to using this library. I am only using it because I want my
program to hash something using HMAC. I am triing to figure it out.
Here's my code:
#include <cryptopp/md5.h>
#include <cryptopp/filters.h>
#include <cryptopp/files.h>
#include <cryptopp/hex.h>
#include
<cryptopp/hmac.h>
#include <iostream>
using namespace CryptoPP;
using namespace std;
int main( int argc, char** argv ) {
char* pbKey="key";
int nKeyLen=sizeof(pbKey);
char* pbOutputBuffer;
char* pbData="Karol";
int nDataLen=sizeof(pbData);
HMAC<MD5 >(pbKey,nKeyLen).CalculateDigest(pbOutputBuffer,pbData,
nDataLen);
cout << "Digest: " << pbOutputBuffer << endl;
return 0;
}
When I compile it with gcc 3.3.2, I get the following errors:
g++ main.cpp -lcryptopp -o test
main.cpp: In function `int main(int, char**)':
main.cpp:18: error: invalid conversion from `const char*' to `const
byte*'
main.cpp:18: error: initializing argument 1 of
`CryptoPP::HMAC<T>::HMAC(const
byte*, unsigned int) [with T = CryptoPP::MD5]'
main.cpp:18: error: invalid conversion from `char*' to `byte*'
main.cpp:18: error: initializing argument 1 of `virtual void
CryptoPP::HashTransformation::CalculateDigest(byte*, const byte*,
unsigned
int)'
main.cpp:18: error: invalid conversion from `const char*' to `const
byte*'
main.cpp:18: error: initializing argument 2 of `virtual void
CryptoPP::HashTransformation::CalculateDigest(byte*, const byte*,
unsigned
int)'
I have searched for some time, and the "documentation" that this thing
has didn't answer my question or fix my errors.
--
Cheers
--RoadkillBunny