Add support for other System.IO.Hashing algorithms

This commit is contained in:
Matt Nadareski
2024-03-03 22:18:32 -05:00
parent 1ccfd51abe
commit 81668127f1
3 changed files with 16 additions and 4 deletions

View File

@@ -46,17 +46,27 @@ namespace SabreTools.Hashing
/// spamsum fuzzy hash
/// </summary>
SpamSum,
#if NET6_0_OR_GREATER
#if NET6_0_OR_GREATER
/// <summary>
/// xxHash 32-bit hash
/// xxHash32 hash
/// </summary>
XxHash32,
/// <summary>
/// xxHash 64-bit hash
/// xxHash64 hash
/// </summary>
XxHash64,
/// <summary>
/// XXH3 64-bit hash
/// </summary>
XxHash3,
/// <summary>
/// XXH128 128-bit hash
/// </summary>
XxHash128,
#endif
}
}

View File

@@ -107,6 +107,8 @@ namespace SabreTools.Hashing
#if NET462_OR_GREATER || NETCOREAPP
HashType.XxHash32 => new XxHash32(),
HashType.XxHash64 => new XxHash64(),
HashType.XxHash3 => new XxHash3(),
HashType.XxHash128 => new XxHash128(),
#endif
_ => null,
};

View File

@@ -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) | SpamSum | Some code tweaks made to support older .NET versions |
| [Compress](https://github.com/RomVault/RVWorld/tree/master/Compress) | N/A | Used for threaded hashing |
| [System.IO.Hashing](https://www.nuget.org/packages/System.IO.Hashing) | CRC-32, CRC-64, xxHash32, xxHash64 | Used in `net462` and above |
| [System.IO.Hashing](https://www.nuget.org/packages/System.IO.Hashing) | CRC-32, CRC-64, xxHash32, xxHash64, XXH3, XXH128 | Used in `net462` and above |
| [System.Security.Cryptography](https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography) | MD5, SHA-1, SHA-256, SHA-384, SHA-512 | Built-in library |
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Hashing).