0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 17:10:44 -05:00

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 <brownelltyler@gmail.com>
Reviewed-on: SPT-AKI/Launcher#42
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
This commit is contained in:
Refringe 2024-03-05 08:34:14 +00:00 committed by chomp
parent 82d401bc43
commit 5c703a2fc6

View File

@ -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);
}