From dc3d44a458ecb878bddad6307a05916e8c0a8dec Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 Apr 2025 15:53:23 +0100 Subject: [PATCH] actually write a hex string in caps --- OpenSim/Framework/Util.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a54c379bc6..df875d5b73 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1337,17 +1337,32 @@ namespace OpenSim.Framework /// /// /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string SHA1Hash(byte[] data) { byte[] hash = ComputeSHA1Hash(data); return bytesToHexString(hash, false); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static byte[] ComputeSHA1Hash(byte[] src) { return SHA1.HashData(src); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string SHA256Hash(byte[] data) + { + return SHA256Hash(data.AsSpan()); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static string SHA256Hash(ReadOnlySpan data) + { + byte[] hash = SHA256.HashData(data); + return bytesToHexString(hash, false); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static UUID ComputeSHA1UUID(string src) { @@ -3520,7 +3535,7 @@ namespace OpenSim.Framework catch (Exception) { Interlocked.Decrement(ref numQueuedThreadFuncs); - activeThreads.TryRemove(threadFuncNum, out ThreadInfo dummy); + activeThreads.TryRemove(threadFuncNum, out _); throw; } }