mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-28 21:50:41 +02:00
using md5.h
This commit is contained in:
parent
4571b1b91c
commit
2aa16eac44
@ -5,6 +5,7 @@ set(SOURCES
|
|||||||
src/CmdProxy.cpp
|
src/CmdProxy.cpp
|
||||||
src/CmdParser.cpp
|
src/CmdParser.cpp
|
||||||
src/Pattern.cpp
|
src/Pattern.cpp
|
||||||
|
../slsSupportLib/opensslMd5/md5.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(slsDetectorObject OBJECT
|
add_library(slsDetectorObject OBJECT
|
||||||
@ -34,6 +35,7 @@ set(PUBLICHEADERS
|
|||||||
include/sls/Detector.h
|
include/sls/Detector.h
|
||||||
include/sls/Result.h
|
include/sls/Result.h
|
||||||
include/sls/Pattern.h
|
include/sls/Pattern.h
|
||||||
|
../slsSupportLib/opensslMd5/md5.h
|
||||||
)
|
)
|
||||||
|
|
||||||
#Shared library
|
#Shared library
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
|
#include "md5.h"
|
||||||
#include "sls/ClientSocket.h"
|
#include "sls/ClientSocket.h"
|
||||||
#include "sls/ToString.h"
|
#include "sls/ToString.h"
|
||||||
#include "sls/bit_utils.h"
|
#include "sls/bit_utils.h"
|
||||||
@ -11,7 +12,6 @@
|
|||||||
#include "sls/string_utils.h"
|
#include "sls/string_utils.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
@ -3412,10 +3412,21 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
|
|||||||
return myMod;
|
return myMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Module::calculateChecksum(char *buffer, ssize_t bytes) {
|
||||||
|
MD5_CTX c;
|
||||||
|
MD5_Init(&c);
|
||||||
|
MD5_Update(&c, bufer, bytes);
|
||||||
|
unsigned char out[MD5_DIGEST_LENGTH];
|
||||||
|
MD5_Final(out, &c);
|
||||||
|
return std::string(out);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::programFPGAviaBlackfin(std::vector<char> buffer,
|
void Module::programFPGAviaBlackfin(std::vector<char> buffer,
|
||||||
const std::string &checksum) {
|
const std::string &checksum) {
|
||||||
uint64_t filesize = buffer.size();
|
uint64_t filesize = buffer.size();
|
||||||
LOG(logDEBUG1) << "checksum:" << checksum;
|
LOG(logINFOBLUE) << "checksum 1:" << checksum;
|
||||||
|
LOG(logINFOBLUE) << "checksum 2:"
|
||||||
|
<< calculateChecksum(buffer.data(), filesize);
|
||||||
|
|
||||||
// send program from memory to detector
|
// send program from memory to detector
|
||||||
LOG(logINFO) << "Sending programming binary (from pof) to module "
|
LOG(logINFO) << "Sending programming binary (from pof) to module "
|
||||||
|
@ -744,6 +744,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
|
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
|
||||||
sls_detector_module readSettingsFile(const std::string &fname,
|
sls_detector_module readSettingsFile(const std::string &fname,
|
||||||
bool trimbits = true);
|
bool trimbits = true);
|
||||||
|
std::string calculateChecksum(char *buffer, ssize_t bytes);
|
||||||
void programFPGAviaBlackfin(std::vector<char> buffer,
|
void programFPGAviaBlackfin(std::vector<char> buffer,
|
||||||
const std::string &checksum);
|
const std::string &checksum);
|
||||||
void programFPGAviaNios(std::vector<char> buffer);
|
void programFPGAviaNios(std::vector<char> buffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user