mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
added _SLS to MD5 functions, added a separate lib for the md5 C code
This commit is contained in:
@ -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