Crypto C++
i try to compile this
#include <iostream>
#include "md5.h"
using namespace std;
//prototype function declaration
void input();
int GetSeed();
typedef unsigned int u8,u32;
//
char password[128]; //input() will pass the characters typed to the variable "password"
void input()
{
cout<<"Input Password: ";
cin>>password;
cin.get();
}
int main()
{
input();
}
void hashtest()
{
u8 hash[16] = {0};
// HashPassword(password, hash, sizeof(hash)); //for now just set some arbitrary values in 'hash'
char szSeed[(sizeof(u32) * 3) + 1] = {0};
itoa(AuthNet::GetSeed(), szSeed, 10); //GetSeed() is just a func that returns int, set it to whatever you like
MD5 md5;
u8 digest[MD5::DIGESTSIZE];
md5.Update(hash, sizeof(hash));
md5.Update((u8 *)szSeed, strlen(szSeed));
md5.Final(digest);// this is garble-2
}
and i get these errors...wtf
../hashtest.cpp: In function `void hashtest()':
../hashtest.cpp:32: error: `AuthNet' has not been declared
../hashtest.cpp:33: error: `MD5' undeclared (first use this function)
../hashtest.cpp:33: error: (Each undeclared identifier is reported only once for each function it appears in.)
../hashtest.cpp:33: error: expected `;' before "md5"
../hashtest.cpp:34: error: `MD5' has not been declared
../hashtest.cpp:34: error: `DIGESTSIZE' undeclared (first use this function)
../hashtest.cpp:35: error: `md5' undeclared (first use this function)
../hashtest.cpp:37: error: `digest' undeclared (first use this function)
make.exe: *** ["../hashtest.o"] Error 1
Execution terminated
Well, you have to give us more informations about that md5.h header (it is not the one of the MD5Lib, right?)
Without this, how can you expect us to know what are thoses MD5 or AuthNet symbols? We are rather bad at mind reading.
Regards,
edit:
In the md5lib, the MD5 class is defined in md5s.h, not md5.h. But I'm still not able to find AuthNet.
Without this, how can you expect us to know what are thoses MD5 or AuthNet symbols? We are rather bad at mind reading.
Regards,
edit:
In the md5lib, the MD5 class is defined in md5s.h, not md5.h. But I'm still not able to find AuthNet.
I assume md5.h is as specified in the rfc http://www.ietf.org/rfc/rfc1321.txt
At the bottom of all that code is a sample app that uses the algorithm called mddriver.c
You need to include md5.c as well as md5.h
If you would rather use MSCrypto API that is a different story.
At the bottom of all that code is a sample app that uses the algorithm called mddriver.c
You need to include md5.c as well as md5.h
If you would rather use MSCrypto API that is a different story.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement