Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace K4os.Hash.xxHash with System.IO.Hashing #7831

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.CodeDom.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.Collections.Immutable.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.Buffers.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)System.IO.Hashing.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Aapt.targets" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Aapt2.targets" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Analysis.targets" />
Expand Down Expand Up @@ -322,7 +323,6 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Build.AsyncTask.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Build.AsyncTask.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)K4os.Compression.LZ4.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)K4os.Hash.xxHash.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ELFSharp.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ManifestOverlays\Timing.xml" />
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>0fe864fc71191ff4ee18e59ef0af2929ca367a11</Sha>
</Dependency>
<Dependency Name="System.IO.Hashing" Version="8.0.0-alpha.1.23080.2" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>9529803ae29c2804880c6bd8ca710b8c037cb498</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22103.1">
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version>8.0.0-alpha.1.23077.4</MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100alpha1Version)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
<SystemIOHashingPackageVersion>8.0.0-alpha.1.23080.2</SystemIOHashingPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Match the first three version numbers and append 00 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System;
using System.IO.Hashing;
using System.Text;

using K4os.Hash.xxHash;

namespace Xamarin.Android.Tasks
{
class AssemblyStoreIndexEntry
Expand Down Expand Up @@ -37,8 +36,8 @@ public AssemblyStoreIndexEntry (string name, uint blobID, uint mappingIndex, uin
LocalBlobIndex = localBlobIndex;

byte[] nameBytes = Encoding.UTF8.GetBytes (name);
NameHash32 = XXH32.DigestOf (nameBytes, 0, nameBytes.Length);
NameHash64 = XXH64.DigestOf (nameBytes, 0, nameBytes.Length);
NameHash32 = XxHash32.HashToUInt32 (nameBytes);
NameHash64 = XxHash64.HashToUInt64 (nameBytes);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.IO;
using System.IO.Hashing;
using System.Text;

using K4os.Hash.xxHash;

using Xamarin.Android.Tools;

namespace Xamarin.Android.Tasks.LLVMIR
Expand Down Expand Up @@ -45,10 +44,10 @@ protected ulong HashName (string name, bool is64Bit)
{
byte[] nameBytes = Encoding.UTF8.GetBytes (name);
if (is64Bit) {
return XXH64.DigestOf (nameBytes, 0, nameBytes.Length);
return XxHash64.HashToUInt64 (nameBytes);
}

return (ulong)XXH32.DigestOf (nameBytes, 0, nameBytes.Length);
return (ulong)XxHash32.HashToUInt32 (nameBytes);
}

protected virtual void InitGenerator (LlvmIrGenerator generator)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO.Hashing;
using System.Linq;
using System.Text;

using K4os.Hash.xxHash;
using Xamarin.Android.Tasks.LLVMIR;

namespace Xamarin.Android.Tasks
Expand Down Expand Up @@ -306,10 +306,10 @@ ulong HashName (string name)
ulong HashBytes (byte[] bytes)
{
if (is64Bit) {
return XXH64.DigestOf (bytes, 0, bytes.Length);
return XxHash64.HashToUInt64 (bytes);
}

return (ulong)XXH32.DigestOf (bytes, 0, bytes.Length);
return (ulong)XxHash32.HashToUInt32 (bytes);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
<PackageReference Include="NuGet.Protocol" Version="$(NuGetApiPackageVersion)" />
<PackageReference Include="NuGet.Versioning" Version="$(NuGetApiPackageVersion)" />
<PackageReference Include="System.CodeDom" />
<PackageReference Include="System.IO.Hashing" Version="$(SystemIOHashingPackageVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="6.0.1" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="K4os.Hash.xxHash" Version="1.0.6" />
<PackageReference Include="ELFSharp" Version="$(ELFSharpVersion)" />
</ItemGroup>

Expand Down