mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07:13 +02:00
added _SLS to MD5 functions, added a separate lib for the md5 C code
This commit is contained in:
@ -276,7 +276,7 @@ namespace sls {
|
||||
#define INIT_DATA_C (unsigned long)0x98badcfeL
|
||||
#define INIT_DATA_D (unsigned long)0x10325476L
|
||||
|
||||
int MD5_Init(MD5_CTX *c)
|
||||
int MD5_Init_SLS(MD5_CTX *c)
|
||||
{
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->A = INIT_DATA_A;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "sls/md5_helper.h"
|
||||
|
||||
#include "sls/md5.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
@ -8,15 +10,15 @@ namespace sls {
|
||||
|
||||
std::string md5_calculate_checksum(char *buffer, ssize_t bytes) {
|
||||
MD5_CTX c;
|
||||
if (!MD5_Init(&c)) {
|
||||
if (!MD5_Init_SLS(&c)) {
|
||||
throw std::runtime_error(
|
||||
"Could not calculate md5 checksum.[initializing]");
|
||||
}
|
||||
if (!MD5_Update(&c, buffer, bytes)) {
|
||||
if (!MD5_Update_SLS(&c, buffer, bytes)) {
|
||||
throw std::runtime_error("Could not calculate md5 checksum.[Updating]");
|
||||
}
|
||||
unsigned char out[MD5_DIGEST_LENGTH];
|
||||
if (!MD5_Final(out, &c)) {
|
||||
if (!MD5_Final_SLS(out, &c)) {
|
||||
throw std::runtime_error("Could not calculate md5 checksum.[Final]");
|
||||
}
|
||||
std::ostringstream oss;
|
||||
|
Reference in New Issue
Block a user