Mercurial > hg > orthanc
changeset 5381:be0b9c407985
simplifying new signature of Toolbox::ComputeMD5()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Sep 2023 07:44:52 +0200 |
parents | 97004471a5c5 |
children | 746a8a792a74 |
files | OrthancFramework/Sources/Toolbox.cpp |
diffstat | 1 files changed, 5 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Toolbox.cpp Thu Aug 31 16:34:53 2023 +0200 +++ b/OrthancFramework/Sources/Toolbox.cpp Mon Sep 04 07:44:52 2023 +0200 @@ -500,28 +500,14 @@ void Toolbox::ComputeMD5(std::string& result, const std::set<std::string>& data) { - md5_state_s state; - md5_init(&state); - - if (data.size() > 0) + std::string s; + + for (std::set<std::string>::const_iterator it = data.begin(); it != data.end(); ++it) { - for (std::set<std::string>::const_iterator it = data.begin(); it != data.end(); ++it) - { - md5_append(&state, - reinterpret_cast<const md5_byte_t*>(it->c_str()), - static_cast<int>(it->size())); - } + s += *it; } - md5_byte_t actualHash[16]; - md5_finish(&state, actualHash); - - result.resize(32); - for (unsigned int i = 0; i < 16; i++) - { - result[2 * i] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] / 16)); - result[2 * i + 1] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] % 16)); - } + ComputeMD5(result, s); } #endif