From 8042ffd156f4d5436a8fda6beed65f60121b6f2d Mon Sep 17 00:00:00 2001
From: Klaus Fischer <klaus.fischer@eloware.com>
Date: Mon, 26 Dec 2022 15:25:13 +0100
Subject: [PATCH] Added logger output for not matching hash

---
 FitConnect/Subscriber.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/FitConnect/Subscriber.cs b/FitConnect/Subscriber.cs
index 4248ed2f..7427007f 100644
--- a/FitConnect/Subscriber.cs
+++ b/FitConnect/Subscriber.cs
@@ -372,6 +372,10 @@ public class Subscriber : FitConnectClient, ISubscriberWithSubmission,
 
                 // SuccessCriteria: Hash-Check 5.4
                 if (attachmentMeta?.Hash.Content != FitEncryption.CalculateHash(content).Content) {
+                    Logger?.LogWarning(
+                        "Wrong hash for attachment {attachment}\nHash should be {should} but is {is}",
+                        id, FitEncryption.CalculateHash(content).Content,
+                        attachmentMeta?.Hash.Content);
                     var problem = new Problems(
                         Problems.ProblemTypeEnum.HashMismatch,
                         Problems.TitleHashMismatch,
-- 
GitLab