opencl,sc: convert callers of rtl_digest_MD5 to comphelper::Hash

Signed-off-by: Michael Stahl <michael.stahl@collabora.com>
Change-Id: Ib507b0e73fce064a7dbd2426849d9bf32bb95295
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4672
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit abd6c2a86dfc250ba9110afa48f10cb2d149bafb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207204
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2026-06-24 00:07:03 +02:00
committed by Xisco Fauli
parent 592e67c4f2
commit 6e9c3fb2be
2 changed files with 10 additions and 15 deletions
+4 -6
View File
@@ -17,11 +17,11 @@
#include <opencl/platforminfo.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
#include <rtl/digest.h>
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
#include <comphelper/hash.hxx>
#include <opencl/OpenCLZone.hxx>
#include <memory>
@@ -66,14 +66,12 @@ namespace
OString generateMD5(const void* pData, size_t length)
{
sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_MD5];
rtlDigestError aError = rtl_digest_MD5(pData, length,
pBuffer, RTL_DIGEST_LENGTH_MD5);
SAL_WARN_IF(aError != rtl_Digest_E_None, "opencl", "md5 generation failed");
::std::vector<unsigned char> hash{
::comphelper::Hash::calculateHash(pData, length, ::comphelper::HashType::MD5)};
OStringBuffer aBuffer(length * 2);
const char* const pString = "0123456789ABCDEF";
for(sal_uInt8 val : pBuffer)
for(sal_uInt8 val : hash)
{
aBuffer.append(OStringChar(pString[val/16]) + OStringChar(pString[val%16]));
}
+6 -9
View File
@@ -13,6 +13,7 @@
#include <formulacell.hxx>
#include <tokenarray.hxx>
#include <compiler.hxx>
#include <comphelper/hash.hxx>
#include <comphelper/random.hxx>
#include <scmatrix.hxx>
#include <sal/log.hxx>
@@ -60,9 +61,6 @@ const char* const publicFunc =
#include <map>
#include <iostream>
#include <algorithm>
#include <rtl/digest.h>
#include <memory>
using namespace formula;
@@ -2556,12 +2554,11 @@ std::string const & DynamicKernel::GetMD5()
{
outputstream md5s;
// Compute MD5SUM of kernel body to obtain the name
sal_uInt8 result[RTL_DIGEST_LENGTH_MD5];
rtl_digest_MD5(
mFullProgramSrc.c_str(),
mFullProgramSrc.length(), result,
RTL_DIGEST_LENGTH_MD5);
for (sal_uInt8 i : result)
::std::vector<unsigned char> hash{
::comphelper::Hash::calculateHash(mFullProgramSrc.c_str(),
mFullProgramSrc.length(), ::comphelper::HashType::MD5)};
for (sal_uInt8 i : hash)
{
md5s << std::hex << static_cast<int>(i);
}