From 5c703a2fc68a6afe702af09ad15948bed32ebac4 Mon Sep 17 00:00:00 2001 From: Refringe Date: Tue, 5 Mar 2024 08:34:14 +0000 Subject: [PATCH] Refactor SHA256 Usage (!42) This commit updates the SHA256 cryptographic usage from SHA256CryptoServiceProvider to the SHA256.Create() method across the PatchUtil.cs file. The change addresses the SYSLIB0021 warning regarding the obsolescence of derived cryptographic types. - Replace SHA256CryptoServiceProvider with SHA256.Create() - Eliminate SYSLIB0021 warnings Co-authored-by: Tyler Brownell Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Launcher/pulls/42 Co-authored-by: Refringe Co-committed-by: Refringe --- project/Aki.ByteBanger/PatchUtil.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project/Aki.ByteBanger/PatchUtil.cs b/project/Aki.ByteBanger/PatchUtil.cs index f5b67b5..e032cf1 100644 --- a/project/Aki.ByteBanger/PatchUtil.cs +++ b/project/Aki.ByteBanger/PatchUtil.cs @@ -24,7 +24,7 @@ namespace Aki.ByteBanger PatchedLength = patched.Length }; - using (SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider()) + using (SHA256 sha256 = SHA256.Create()) { pi.OriginalChecksum = sha256.ComputeHash(original); pi.PatchedChecksum = sha256.ComputeHash(patched); @@ -97,7 +97,7 @@ namespace Aki.ByteBanger public static PatchResult Patch(byte[] input, PatchInfo pi) { byte[] inputHash; - using (SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider()) + using (SHA256 sha256 = SHA256.Create()) { inputHash = sha256.ComputeHash(input); } @@ -114,7 +114,7 @@ namespace Aki.ByteBanger Array.Copy(itm.Data, 0, patchedData, itm.Offset, itm.Data.Length); byte[] patchedHash; - using (SHA256CryptoServiceProvider sha256 = new SHA256CryptoServiceProvider()) + using (SHA256 sha256 = SHA256.Create()) { patchedHash = sha256.ComputeHash(patchedData); }