Mercurial > hg > orthanc
comparison Core/Toolbox.cpp @ 1479:8f28a1cd2354
possibility to disable md5 and base64 support in the toolbox
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 02 Aug 2015 12:20:27 +0200 |
parents | 8dc80ba768aa |
children | f176ec4467e6 |
comparison
equal
deleted
inserted
replaced
1478:1011bd6ab00b | 1479:8f28a1cd2354 |
---|---|
80 #error Since version 0.7.6, Orthanc entirely relies on boost::locale | 80 #error Since version 0.7.6, Orthanc entirely relies on boost::locale |
81 #endif | 81 #endif |
82 | 82 |
83 #include <boost/locale.hpp> | 83 #include <boost/locale.hpp> |
84 | 84 |
85 | |
86 #if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1 | |
85 #include "../Resources/ThirdParty/md5/md5.h" | 87 #include "../Resources/ThirdParty/md5/md5.h" |
88 #endif | |
89 | |
90 | |
91 #if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 | |
86 #include "../Resources/ThirdParty/base64/base64.h" | 92 #include "../Resources/ThirdParty/base64/base64.h" |
93 #endif | |
87 | 94 |
88 | 95 |
89 #if defined(_MSC_VER) && (_MSC_VER < 1800) | 96 #if defined(_MSC_VER) && (_MSC_VER < 1800) |
90 // Patch for the missing "_strtoll" symbol when compiling with Visual Studio < 2013 | 97 // Patch for the missing "_strtoll" symbol when compiling with Visual Studio < 2013 |
91 extern "C" | 98 extern "C" |
449 else | 456 else |
450 return (value - 10) + 'a'; | 457 return (value - 10) + 'a'; |
451 } | 458 } |
452 | 459 |
453 | 460 |
461 #if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1 | |
454 void Toolbox::ComputeMD5(std::string& result, | 462 void Toolbox::ComputeMD5(std::string& result, |
455 const std::string& data) | 463 const std::string& data) |
456 { | 464 { |
457 if (data.size() > 0) | 465 if (data.size() > 0) |
458 { | 466 { |
487 { | 495 { |
488 result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16); | 496 result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16); |
489 result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16); | 497 result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16); |
490 } | 498 } |
491 } | 499 } |
492 | 500 #endif |
493 | 501 |
502 | |
503 #if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 | |
494 void Toolbox::EncodeBase64(std::string& result, | 504 void Toolbox::EncodeBase64(std::string& result, |
495 const std::string& data) | 505 const std::string& data) |
496 { | 506 { |
497 result = base64_encode(data); | 507 result = base64_encode(data); |
498 } | 508 } |
500 void Toolbox::DecodeBase64(std::string& result, | 510 void Toolbox::DecodeBase64(std::string& result, |
501 const std::string& data) | 511 const std::string& data) |
502 { | 512 { |
503 result = base64_decode(data); | 513 result = base64_decode(data); |
504 } | 514 } |
515 #endif | |
516 | |
505 | 517 |
506 | 518 |
507 #if defined(_WIN32) | 519 #if defined(_WIN32) |
508 static std::string GetPathToExecutableInternal() | 520 static std::string GetPathToExecutableInternal() |
509 { | 521 { |