-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[API Proposal]: XxHash128 #77885
Comments
Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones Issue DetailsBackground and motivationFollowup of the previous API proposal for XX3 64 bit #75948 The current XxHash3 implementation provides a 64 bit hash. But XXH3 128 is also quite useful for e.g fast content adressable storage scenarios. This proposal is about adding a API Proposalnamespace System.IO.Hashing;
public sealed partial class XxHash128 : NonCryptographicHashAlgorithm
{
public XxHash128();
public XxHash128(int seed);
public static byte[] Hash(byte[] source);
public static byte[] Hash(byte[] source, int seed);
public static byte[] Hash(ReadOnlySpan<byte> source, int seed = 0);
public static int Hash(ReadOnlySpan<byte> source, Span<byte> destination, int seed = 0);
public static bool TryHash(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, int seed = 0);
} API Usageint bytesWritten = XxHash128.Hash(source, destination); Alternative DesignsNo response RisksNo response
|
Is it correct that the seeds are ints instead of longs? |
Indeed, it should be long, I have updated. |
I've marked this as api-ready-for-review. I believe this is just a formality: we basically rubber-stamped this when reviewing XxHash3, saying we'd add XxHash128 if there was a demonstrated need, and the proposed API follows the same shape/pattern as all the other algorithms in the library. |
Moving this to 8.0 given that that is what |
namespace System.IO.Hashing;
public sealed partial class XxHash128 : NonCryptographicHashAlgorithm
{
public XxHash128();
public XxHash128(long seed);
public static byte[] Hash(byte[] source);
public static byte[] Hash(byte[] source, long seed);
public static byte[] Hash(ReadOnlySpan<byte> source, long seed = 0);
public static int Hash(ReadOnlySpan<byte> source, Span<byte> destination, long seed = 0);
public static bool TryHash(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, long seed = 0);
} |
Background and motivation
Followup of the previous API proposal for XX3 64 bit #75948
The current XxHash3 implementation provides a 64 bit hash. But XXH3 128 is also quite useful for e.g fast content adressable storage scenarios.
This proposal is about adding a
XxHash128
API and implementation.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: