DepotDownloader: Removed reliance on Classless.Hasher.

pull/8/head
Nicholas Hastings 13 years ago
parent 5262ec9667
commit a8e714ea12

@ -56,10 +56,6 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Classless.Hasher, Version=0.9.4179.24334, Culture=neutral, PublicKeyToken=25b6bb7f72693b18, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\SteamKit2\Classless.Hasher.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>

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

Loading…
Cancel
Save