// Decompiled with JetBrains decompiler // Type: Microsoft.InfoCards.HashUtility // Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // MVID: 1D4D5564-A025-490C-AF1D-DF4FBB709D1F // Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-f8f9f26e940480624825f6bddbea86e70fc4aa746c4dd8efa7d98dcb477000ed.exe using Microsoft.InfoCards.Diagnostics; using System; using System.Security.Cryptography; namespace Microsoft.InfoCards { internal static class HashUtility { public const string HashAlgorithmName = "SHA256"; private static object s_lock = new object(); private static SHA256Managed s_hasher = new SHA256Managed(); public static int HashBitLength => HashUtility.s_hasher.HashSize; public static int HashBufferLength => HashUtility.HashBitLength / 8; public static void SetHashValue(byte[] data, int dataIndex, byte[] dataToHash) { if (dataToHash == null) throw InfoCardTrace.ThrowHelperArgumentNull(nameof (dataToHash)); HashUtility.SetHashValue(data, dataIndex, dataToHash, 0, dataToHash.Length); } public static void SetHashValue( byte[] data, int dataIndex, byte[] dataToHash, int dataToHashIndex, int dataToHashSize) { if (data == null) throw InfoCardTrace.ThrowHelperArgumentNull(nameof (data)); if (dataIndex < 0 || dataIndex >= data.Length) throw InfoCardTrace.ThrowHelperError((Exception) new ArgumentOutOfRangeException(nameof (dataIndex), (object) dataIndex, SR.GetString("StoreHashUtilityDataOutOfRange"))); if (dataToHash == null) throw InfoCardTrace.ThrowHelperArgumentNull(nameof (dataToHash)); if (dataToHashIndex < 0 || dataToHashIndex > dataToHash.Length) throw InfoCardTrace.ThrowHelperError((Exception) new ArgumentOutOfRangeException(nameof (dataToHashIndex), (object) dataToHashIndex, SR.GetString("StoreHashUtilityDataToHashOutOfRange"))); if (dataToHashSize < 0 || dataToHashSize > dataToHash.Length - dataToHashIndex) throw InfoCardTrace.ThrowHelperError((Exception) new ArgumentOutOfRangeException(nameof (dataToHashIndex), (object) dataToHashIndex, SR.GetString("StoreHashUtilityDataToHashOutOfRange"))); byte[] sourceArray = (byte[]) null; lock (HashUtility.s_lock) sourceArray = HashUtility.s_hasher.ComputeHash(dataToHash, dataToHashIndex, dataToHashSize); Array.Copy((Array) sourceArray, 0, (Array) data, dataIndex, sourceArray.Length); Array.Clear((Array) sourceArray, 0, sourceArray.Length); } } }