use better hash method

This commit is contained in:
2025-02-11 07:29:18 +01:00
parent 07ab60666a
commit 7b38286642
3 changed files with 6 additions and 16 deletions

View File

@@ -41,7 +41,11 @@ public static class Helpers
var dateTime = DateTime.UtcNow.ToString("yyyyMMddHHmmssfffffff"); var dateTime = DateTime.UtcNow.ToString("yyyyMMddHHmmssfffffff");
var type = typeof(T).ToString(); var type = typeof(T).ToString();
var together = sn + dateTime + type + var; var together = sn + dateTime + type + var;
var hash = BitConverter.ToString(new HMACMD5().ComputeHash(Encoding.Default.GetBytes(together))).Replace("-", string.Empty); #if NET5_0_OR_GREATER
var hash = BitConverter.ToString(MD5.HashData(Encoding.Default.GetBytes(together))).Replace("-", string.Empty);
#else
var hash = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(together))).Replace("-", string.Empty);
#endif
return hash; return hash;
} }
} }

View File

@@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Version>2.1.1</Version> <Version>2.1.2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,20 +1,6 @@
using System; using System;
using System.IO; using System.IO;
/* Nicht gemergte Änderung aus Projekt "Pilz.Cryptography (net6.0)"
Vor:
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
Nach:
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
*/
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;