26#define BOOST_NO_CXX11_SCOPED_ENUMS
27#include <boost/filesystem.hpp>
28#undef BOOST_NO_CXX11_SCOPED_ENUMS
31#include "fastrtps/TopicDataType.h"
34namespace localization {
39 unsigned char res[kUcharMd5Length]) {
41 unsigned char *buf_pt = &buf[0];
43 FILE *file = fopen(file_path.c_str(),
"rb");
44 size_t total_size = 0;
50 buf_pt = &buf[count - 1];
53 size_t size = fread(buf_pt,
sizeof(
unsigned char),
kBufferSize, file);
59 AERROR <<
"Can't find the file: " << file_path;
68 char res[kCharMd5Lenth]) {
70 unsigned char *buf_pt = &buf[0];
72 FILE *file = fopen(file_path.c_str(),
"rb");
73 size_t total_size = 0;
79 buf_pt = &buf[count - 1];
82 size_t size = fread(buf_pt,
sizeof(
unsigned char),
kBufferSize, file);
88 AERROR <<
"Can't find the file: " << file_path;
97 unsigned char res[kUcharMd5Length]) {
100 md5.update(binary,
static_cast<unsigned int>(size));
103 res[i] = md5.digest[i];
108 char res[kCharMd5Lenth]) {
111 char tmp[3] = {
'\0'};
116 snprintf(tmp,
sizeof(tmp),
"%02X", md[i]);
117 strncat(buf, tmp,
sizeof(tmp));
120 memcpy(res, buf,
sizeof(buf));
static void ComputeFileMd5(const std::string &file_path, unsigned char res[kUcharMd5Length])
Compute file md5 given a file path.
static const size_t kCharMd5Lenth
static void ComputeBinaryMd5(const unsigned char *binary, size_t size, unsigned char res[kUcharMd5Length])
Compute file md5 given a binary chunk.
static const size_t kUcharMd5Length