public void TestCompletenessReportHashing() { BO4E.StaticLogger.Logger = new Microsoft.Extensions.Logging.Debug.DebugLogger("Testlogger", (log, level) => { return(true); }); CompletenessReport cr = new CompletenessReport() { LokationsId = "56789012345", Coverage = 0.9M, Einheit = BO4E.ENUM.Mengeneinheit.MWH, wertermittlungsverfahren = BO4E.ENUM.Wertermittlungsverfahren.MESSUNG, UserProperties = new Dictionary <string, JToken>() { { "anlage", "5012345678" }, { "profil", "123456" } } }; Assert.IsTrue(cr.IsValid()); var conf = new AnonymizerConfiguration(); conf.SetOption(DataCategory.POD, AnonymizerApproach.HASH); conf.SetOption(DataCategory.USER_PROPERTIES, AnonymizerApproach.HASH); CompletenessReport hashedReport; using (Anonymizer anonymizer = new Anonymizer(conf)) { hashedReport = anonymizer.ApplyOperations <CompletenessReport>(cr); } Assert.IsNotNull(hashedReport); Assert.AreNotEqual(cr.LokationsId, hashedReport.LokationsId); Assert.IsTrue(Marktlokation.ValidateId(hashedReport.LokationsId)); Assert.IsNotNull(cr.UserProperties["anlage"]); Assert.AreNotEqual(cr.UserProperties["anlage"].Value <string>(), hashedReport.UserProperties["anlage"].Value <string>()); Assert.IsNotNull(cr.UserProperties["profil"]); Assert.AreNotEqual(cr.UserProperties["profil"].Value <string>(), hashedReport.UserProperties["profil"].Value <string>()); conf.hashingSalt = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="; CompletenessReport saltedReport; using (Anonymizer anonymizer = new Anonymizer(conf)) { saltedReport = anonymizer.ApplyOperations <CompletenessReport>(cr); } Assert.IsNotNull(saltedReport.LokationsId); Assert.AreNotEqual(cr.LokationsId, saltedReport.LokationsId); Assert.AreNotEqual(hashedReport.LokationsId, saltedReport.LokationsId); Assert.IsTrue(Anonymizer.IsHashedKey(hashedReport.LokationsId)); Assert.IsTrue(Anonymizer.IsHashedKey(saltedReport.LokationsId)); }