ServidorTFG/data_acces.cpp

19 lines
443 B
C++
Raw Normal View History

2020-05-08 12:43:46 +02:00
#include "data_acces.h"
2020-05-31 19:24:35 +02:00
#include <openssl/sha.h>
#include <openssl/evp.h>
#include <string.h>
2020-05-08 12:43:46 +02:00
data_acces::data_acces()
{
}
2020-05-31 19:24:35 +02:00
char* data_acces::get_hash(char *data){
unsigned char hash[SHA512_DIGEST_LENGTH];
SHA512(reinterpret_cast<unsigned const char*>(data), strlen(data), hash);
unsigned char* encodedData= new unsigned char[200];
EVP_EncodeBlock(encodedData, hash, sizeof (hash));
return reinterpret_cast<char*>(encodedData);
}