|
|
@ -36,16 +36,14 @@
|
|
|
|
* internal hash function, calling
|
|
|
|
* internal hash function, calling
|
|
|
|
* the basic methods from md5.h
|
|
|
|
* the basic methods from md5.h
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
std::string md5wrapper::hashit(std::string text)
|
|
|
|
std::string md5wrapper::hashit(unsigned char *data, size_t length)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MD5Context ctx;
|
|
|
|
MD5Context ctx;
|
|
|
|
|
|
|
|
|
|
|
|
//init md5
|
|
|
|
//init md5
|
|
|
|
MD5Init(&ctx);
|
|
|
|
MD5Init(&ctx);
|
|
|
|
//update with our string
|
|
|
|
//update with our string
|
|
|
|
MD5Update(&ctx,
|
|
|
|
MD5Update(&ctx, data, length);
|
|
|
|
(unsigned char*)text.c_str(),
|
|
|
|
|
|
|
|
text.length());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//create the hash
|
|
|
|
//create the hash
|
|
|
|
unsigned char buff[16] = "";
|
|
|
|
unsigned char buff[16] = "";
|
|
|
@ -95,10 +93,9 @@ md5wrapper::~md5wrapper()
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
std::string md5wrapper::getHashFromString(std::string text)
|
|
|
|
std::string md5wrapper::getHashFromString(std::string text)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this->hashit(text);
|
|
|
|
return this->hashit((unsigned char*)text.data(), text.length());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* creates a MD5 hash from
|
|
|
|
* creates a MD5 hash from
|
|
|
|
* a file specified in "filename" and
|
|
|
|
* a file specified in "filename" and
|
|
|
|