From a8e714ea12a52230db7e3344b8ac1729ca8cdcd9 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Mon, 12 Nov 2012 10:38:56 -0500 Subject: [PATCH] DepotDownloader: Removed reliance on Classless.Hasher. --- DepotDownloader/DepotDownloader.csproj | 4 ---- DepotDownloader/Util.cs | 17 +++-------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/DepotDownloader/DepotDownloader.csproj b/DepotDownloader/DepotDownloader.csproj index bd44f5fa..c3ecb3a2 100644 --- a/DepotDownloader/DepotDownloader.csproj +++ b/DepotDownloader/DepotDownloader.csproj @@ -56,10 +56,6 @@ AnyCPU - - False - ..\..\..\SteamKit2\Classless.Hasher.dll - 3.5 diff --git a/DepotDownloader/Util.cs b/DepotDownloader/Util.cs index cdadb049..4750a971 100644 --- a/DepotDownloader/Util.cs +++ b/DepotDownloader/Util.cs @@ -3,7 +3,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; -using Classless.Hasher; +using SteamKit2; namespace DepotDownloader { @@ -97,7 +97,7 @@ namespace DepotDownloader tempchunk = chunk; } int adler = BitConverter.ToInt32(AdlerHash(tempchunk), 0); - int crc32 = BitConverter.ToInt32(CRCHash(tempchunk), 0); + int crc32 = BitConverter.ToInt32(CryptoHelper.CRCHash(tempchunk), 0); if((adler ^ crc32) != checksums[cnt]) { fs.Close(); @@ -129,24 +129,13 @@ namespace DepotDownloader tempchunk = chunk; } int adler = BitConverter.ToInt32(AdlerHash(tempchunk), 0); - int crc32 = BitConverter.ToInt32(CRCHash(tempchunk), 0); + int crc32 = BitConverter.ToInt32(CryptoHelper.CRCHash(tempchunk), 0); checksums[cnt++] = adler ^ crc32; } fs.Close(); return checksums; } - public static byte[] CRCHash( byte[] input ) - { - using ( Crc crc = new Crc( CrcParameters.GetParameters( CrcStandard.Crc32Bit ) ) ) - { - byte[] hash = crc.ComputeHash( input ); - Array.Reverse( hash ); - - return hash; - } - } - public static byte[] AdlerHash(byte[] input) { uint a = 0, b = 0;