From f74c9ddffdf4d23b830fe9fd13739835d7b52ffe Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 8 Nov 2024 13:11:58 -0500 Subject: [PATCH] Use internal implementation for XXH64 --- README.MD | 2 +- SabreTools.Hashing.Test/TestHelper.cs | 2 +- SabreTools.Hashing/HashType.cs | 2 +- SabreTools.Hashing/HashWrapper.cs | 4 +--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.MD b/README.MD index b7abb3b..ba0fdb8 100644 --- a/README.MD +++ b/README.MD @@ -6,7 +6,7 @@ This library comprises of methods and helpers to simplify the process of getting | --- | --- | --- | | [Aaru.Checksums](https://github.com/aaru-dps/Aaru.Checksums) | Adler-32, Fletcher-16, Fletcher-32, SpamSum | Some code tweaks made to support older .NET versions | | [Blake3.NET](https://github.com/xoofx/Blake3.NET) | BLAKE3 | Used in `net7.0` and above | -| [System.IO.Hashing](https://www.nuget.org/packages/System.IO.Hashing) | xxHash64, XXH3, XXH128 | Used in `net462` and above | +| [System.IO.Hashing](https://www.nuget.org/packages/System.IO.Hashing) | XXH3, XXH128 | Used in `net462` and above | | [System.Security.Cryptography](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography) | MD5, RIPEMD160 (.NET Framework only), SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-384, SHA3-512, SHAKE128, SHAKE256 | Built-in library; SHA3-256, SHA3-384, SHA3-512, SHAKE128, and SHAKE256 are `net8.0` and above only for [supported platforms](https://learn.microsoft.com/en-us/dotnet/standard/security/cross-platform-cryptography) | Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Hashing). diff --git a/SabreTools.Hashing.Test/TestHelper.cs b/SabreTools.Hashing.Test/TestHelper.cs index 2cdfddd..b478f96 100644 --- a/SabreTools.Hashing.Test/TestHelper.cs +++ b/SabreTools.Hashing.Test/TestHelper.cs @@ -185,8 +185,8 @@ namespace SabreTools.Hashing.Test {HashType.SpamSum, "3:hMCPQCE6AFQxWyENFACBE+rW6Tj7SMQmKozr9MVERkL:hZRdxZENFs+rPSromekL"}, {HashType.XxHash32, "aa1d338e"}, -#if NET462_OR_GREATER || NETCOREAPP {HashType.XxHash64, "181e9ea4f0f62b08"}, +#if NET462_OR_GREATER || NETCOREAPP {HashType.XxHash3, "f29fda0eeb740404"}, {HashType.XxHash128, "e811cdfb1280efae1be1e1a5b4b434d9"}, #endif diff --git a/SabreTools.Hashing/HashType.cs b/SabreTools.Hashing/HashType.cs index 8f53d6b..25badb2 100644 --- a/SabreTools.Hashing/HashType.cs +++ b/SabreTools.Hashing/HashType.cs @@ -790,12 +790,12 @@ namespace SabreTools.Hashing /// XxHash32, -#if NET462_OR_GREATER || NETCOREAPP /// /// xxHash64 hash /// XxHash64, +#if NET462_OR_GREATER || NETCOREAPP /// /// XXH3 64-bit hash /// diff --git a/SabreTools.Hashing/HashWrapper.cs b/SabreTools.Hashing/HashWrapper.cs index 36636fa..0d6968d 100644 --- a/SabreTools.Hashing/HashWrapper.cs +++ b/SabreTools.Hashing/HashWrapper.cs @@ -45,8 +45,6 @@ namespace SabreTools.Hashing return ic.Final(); #if NET462_OR_GREATER || NETCOREAPP - case XxHash64 xxh64: - return xxh64.GetCurrentHash(); case XxHash3 xxh3: return xxh3.GetCurrentHash(); case XxHash128 xxh128: @@ -303,8 +301,8 @@ namespace SabreTools.Hashing HashType.SpamSum => new SpamSumContext(), HashType.XxHash32 => new XxHash.XxHash32(), + HashType.XxHash64 => new XxHash.XxHash64(), #if NET462_OR_GREATER || NETCOREAPP - HashType.XxHash64 => new XxHash64(), HashType.XxHash3 => new XxHash3(), HashType.XxHash128 => new XxHash128(), #endif