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

Add XxHash128 #77944

Merged
merged 50 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3b78dd9
Add XxHash128
xoofx Nov 5, 2022
c6bf653
Merge branch 'main' into add-xxhash128
xoofx Nov 5, 2022
548c2e8
Optimize XxHash128
xoofx Nov 5, 2022
4c449c0
Missing optimization
xoofx Nov 5, 2022
5a19745
Fix warnings
xoofx Nov 5, 2022
7b916f1
Optimize the 129 To 240 bytes case
xoofx Nov 5, 2022
645dc0e
Fix warnings
xoofx Nov 5, 2022
28cf734
Add missing namespace for tests
xoofx Nov 5, 2022
76d86cc
Split strings in XxHash128 test
xoofx Nov 5, 2022
08f670e
Try to fix tests on CI
xoofx Nov 5, 2022
6f722a5
Add XxHash128 to ref
xoofx Nov 6, 2022
5c1c2a7
Fix compilation errors on non .NET 7 platforms
xoofx Nov 6, 2022
ce89e5c
Fix compilation errors on net472
xoofx Nov 6, 2022
dc4a906
Update src/libraries/System.IO.Hashing/tests/XxHash64Tests.cs
xoofx Nov 12, 2022
75fc262
Update src/libraries/System.IO.Hashing/tests/XxHash3Tests.cs
xoofx Nov 12, 2022
ea57cfc
Update src/libraries/System.IO.Hashing/tests/XxHash128Tests.cs
xoofx Nov 12, 2022
5eb308a
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHashSh…
xoofx Nov 12, 2022
6ed008f
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
6f04fb5
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
1989791
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
37b7046
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
160b820
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
8b4830b
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
35feef1
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
fde336f
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
436dd3f
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash3.cs
xoofx Nov 12, 2022
91ce914
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
5692d84
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
9589abd
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Nov 12, 2022
f82d2d6
Fix usage of var
xoofx Nov 12, 2022
18ab499
Fix comment XXH3 -> XXH128
xoofx Nov 12, 2022
5e3db07
Rename WriteCanonical128 to WriteBigEndian128
xoofx Nov 12, 2022
b0fe876
Fix remaining issues
xoofx Nov 12, 2022
f4f5d08
Merge branch 'main' into add-xxhash128
xoofx Nov 12, 2022
b6452b0
Add tests for XxHash128.HashToUInt128 and GetCurrentHashAsUInt128
xoofx Nov 12, 2022
02c8eb7
Remove spaces
xoofx Nov 12, 2022
dbcd877
Add new methods to ref
xoofx Nov 12, 2022
fe37c28
Try to fix ref file
xoofx Nov 12, 2022
3513d77
Fix ref for .NET 7
xoofx Nov 12, 2022
7c21a47
Split ref files
xoofx Nov 17, 2022
7fb2234
Merge remote-tracking branch 'origin/main' into add-xxhash128
xoofx Nov 17, 2022
5061e3c
Fix ref after merge
xoofx Nov 17, 2022
6a8102f
Update src/libraries/System.IO.Hashing/ref/System.IO.Hashing.netcorea…
xoofx Dec 1, 2022
63f2d9f
Update src/libraries/System.IO.Hashing/src/System/IO/Hashing/XxHash12…
xoofx Dec 1, 2022
0599ba4
Remove System.Linq
xoofx Dec 1, 2022
4505e57
Use PascalCast for local const
xoofx Dec 1, 2022
af4cb41
Remove XorShift64 from XxHash128
xoofx Dec 1, 2022
620ef11
Remove duplicated Multiply32To64
xoofx Dec 1, 2022
74eaced
Improve HashLength129To240
xoofx Dec 1, 2022
d4a9c9a
Reverting System.Linq for XxHash3 and XxHash128
xoofx Dec 1, 2022
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
13 changes: 13 additions & 0 deletions src/libraries/System.IO.Hashing/ref/System.IO.Hashing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ protected virtual void GetHashAndResetCore(System.Span<byte> destination) { }
public bool TryGetCurrentHash(System.Span<byte> destination, out int bytesWritten) { throw null; }
public bool TryGetHashAndReset(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public sealed partial class XxHash128 : System.IO.Hashing.NonCryptographicHashAlgorithm
{
public XxHash128() : base (default(int)) { }
public XxHash128(long seed) : base (default(int)) { }
public override void Append(System.ReadOnlySpan<byte> source) { }
protected override void GetCurrentHashCore(System.Span<byte> destination) { }
public static byte[] Hash(byte[] source) { throw null; }
public static byte[] Hash(byte[] source, long seed) { throw null; }
public static byte[] Hash(System.ReadOnlySpan<byte> source, long seed = (long)0) { throw null; }
public static int Hash(System.ReadOnlySpan<byte> source, System.Span<byte> destination, long seed = (long)0) { throw null; }
public override void Reset() { }
public static bool TryHash(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten, long seed = (long)0) { throw null; }
}
public sealed partial class XxHash3 : System.IO.Hashing.NonCryptographicHashAlgorithm
{
public XxHash3() : base (default(int)) { }
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/System.IO.Hashing/ref/System.IO.Hashing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<Compile Include="System.IO.Hashing.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It would have been better to condition on a compatibility check / version check:

<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">

to not lose the API on net7.0 when $(NetCoreAppCurrent) becomes net8.0. This just started failing in the PR that upgrades to net8.0: https://github.com/dotnet/runtime/pull/78354/checks?check_run_id=9846188314.

I will change this in our PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

<Compile Include="System.IO.Hashing.netcoreapp.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

namespace System.IO.Hashing
{
public sealed partial class XxHash128 : System.IO.Hashing.NonCryptographicHashAlgorithm
{
[System.CLSCompliantAttribute(false)]
public System.UInt128 GetCurrentHashAsUInt128() { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.UInt128 HashToUInt128(System.ReadOnlySpan<byte> source, long seed = 0) { throw null; }
}
}
2 changes: 2 additions & 0 deletions src/libraries/System.IO.Hashing/src/System.IO.Hashing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ System.IO.Hashing.XxHash32</PackageDescription>
<Compile Include="System\IO\Hashing\Crc32.Table.cs" />
<Compile Include="System\IO\Hashing\Crc64.cs" />
<Compile Include="System\IO\Hashing\Crc64.Table.cs" />
<Compile Include="System\IO\Hashing\XxHash128.cs" />
<Compile Include="System\IO\Hashing\XxHash3.cs" />
<Compile Include="System\IO\Hashing\XxHash32.cs" />
<Compile Include="System\IO\Hashing\XxHash32.State.cs" />
<Compile Include="System\IO\Hashing\XxHash64.cs" />
<Compile Include="System\IO\Hashing\XxHash64.State.cs" />
<Compile Include="System\IO\Hashing\XxHashShared.cs" />
<Compile Include="System\IO\Hashing\NonCryptographicHashAlgorithm.cs" />
<Compile Include="$(CommonPath)System\Numerics\Crc32ReflectedTable.cs">
<Link>Common\System\Numerics\Crc32ReflectedTable.cs</Link>
Expand Down
Loading