FolkerKinzel.Strings
1.2.0
Prefix Reserved
See the version list below for details.
dotnet add package FolkerKinzel.Strings --version 1.2.0
NuGet\Install-Package FolkerKinzel.Strings -Version 1.2.0
<PackageReference Include="FolkerKinzel.Strings" Version="1.2.0" />
paket add FolkerKinzel.Strings --version 1.2.0
#r "nuget: FolkerKinzel.Strings, 1.2.0"
// Install FolkerKinzel.Strings as a Cake Addin #addin nuget:?package=FolkerKinzel.Strings&version=1.2.0 // Install FolkerKinzel.Strings as a Cake Tool #tool nuget:?package=FolkerKinzel.Strings&version=1.2.0
FolkerKinzel.Strings
.NET library, containing extension methods for String, StringBuilder and ReadOnlySpan<Char>.
Content:
- Extension methods which return an equal (and therefore persistable) Int32 hashcode for an identical Char sequence everytime they are called - even on String, StringBuilder or ReadOnlySpan<Char>. The hashcodes can be specified to hash the sequence ordinal, ordinal case insensitive or alphanumeric case insensitive. The hashcodes produced by this library are not equivalent to the hashcodes produced by the .NET-Framework 4.0 System.String class, because they use roundshifting to keep more information. Don't use these hashcodes for security critical purposes (such as hashing passwords)!
Example:
using System;
using System.Text;
using FolkerKinzel.Strings;
namespace Examples
{
public static class ShortExample
{
public static void CreateConstantStringHashes()
{
Console.WriteLine("Ordinal:");
const string s1 = "Hello Folker!";
Console.WriteLine(
$"{s1.GetStableHashCode(HashType.Ordinal),10:X08}");
Console.WriteLine(
$"{new StringBuilder().Append(s1).GetStableHashCode(HashType.Ordinal),10:X08}");
Console.WriteLine("OrdinalIgnoreCase:");
Console.WriteLine(
$"{"HELLO FOLKER!".GetStableHashCode(HashType.Ordinal),10:X08}");
Console.WriteLine(
$"{"Hello Folker!".AsSpan().GetStableHashCode(HashType.OrdinalIgnoreCase),10:X08}");
Console.WriteLine("AlphaNumericIgnoreCase:");
Console.WriteLine(
$"{"HELLO FOLKER!".AsSpan().GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");
Console.WriteLine(
$"{new StringBuilder().Append("&: !heL##Lof OLker *").GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");
// Different HashTypes may produce different hashcodes on the same Char sequence
// and must therefore not be mixed:
Console.WriteLine("Same String - different HashTypes:");
Console.WriteLine(
$"{s1.GetStableHashCode(HashType.Ordinal),10:X08}");
Console.WriteLine(
$"{s1.GetStableHashCode(HashType.OrdinalIgnoreCase),10:X08}");
Console.WriteLine(
$"{s1.GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");
}
}
}
/*
Output:
Ordinal:
A31FA6EC
A31FA6EC
OrdinalIgnoreCase:
1BBFB34C
1BBFB34C
AlphaNumericIgnoreCase:
C672C38C
C672C38C
Same String - different HashTypes:
A31FA6EC
1BBFB34C
C672C38C
*/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- System.Memory (>= 4.5.4)
-
.NETStandard 2.0
- System.Memory (>= 4.5.4)
-
.NETStandard 2.1
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on FolkerKinzel.Strings:
Package | Downloads |
---|---|
FolkerKinzel.MimeTypes
.NET Library that supports working with Internet Media Types ("MIME Types") |
|
FolkerKinzel.CsvTools
.NET library to read and write CSV files. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.2.1 | 224 | 11/17/2024 |
9.2.0 | 162 | 11/14/2024 |
9.1.0 | 86 | 11/9/2024 |
9.1.0-beta.1 | 41 | 11/2/2024 |
9.0.0 | 2,929 | 10/6/2024 |
8.1.0 | 8,046 | 6/2/2024 |
8.1.0-beta.3 | 78 | 5/22/2024 |
8.1.0-beta.2 | 67 | 5/20/2024 |
8.1.0-beta.1 | 60 | 5/18/2024 |
8.0.0 | 872 | 5/4/2024 |
8.0.0-beta.1 | 93 | 4/28/2024 |
7.3.0 | 1,644 | 4/10/2024 |
7.2.0 | 1,465 | 11/26/2023 |
7.1.1 | 2,952 | 11/5/2023 |
7.1.0 | 235 | 10/27/2023 |
7.0.1 | 1,894 | 10/18/2023 |
7.0.0 | 337 | 9/24/2023 |
6.4.0 | 261 | 9/23/2023 |
6.3.0 | 190 | 9/21/2023 |
6.2.0 | 199 | 9/19/2023 |
6.1.0 | 172 | 9/17/2023 |
6.0.0 | 153 | 9/10/2023 |
5.3.1 | 213 | 8/24/2023 |
5.3.0 | 453 | 7/22/2023 |
5.2.0 | 239 | 7/15/2023 |
5.1.0 | 261 | 7/10/2023 |
5.0.0 | 267 | 7/1/2023 |
4.4.0 | 57,786 | 1/21/2022 |
4.3.0 | 553 | 1/20/2022 |
4.2.0 | 554 | 1/15/2022 |
4.1.0 | 4,030 | 12/24/2021 |
4.0.0 | 406 | 12/12/2021 |
3.3.0 | 1,500 | 10/27/2021 |
3.2.0 | 468 | 9/5/2021 |
3.2.0-beta.1 | 180 | 8/25/2021 |
3.1.0 | 428 | 8/11/2021 |
3.1.0-beta.1 | 172 | 8/9/2021 |
3.0.0 | 466 | 8/6/2021 |
3.0.0-beta.2 | 182 | 8/4/2021 |
3.0.0-beta | 308 | 7/27/2021 |
2.0.0 | 477 | 6/30/2021 |
1.2.0 | 480 | 2/13/2021 |
1.1.0 | 670 | 7/5/2020 |
Adds support for Netstandard 2.0 and .NET-Framework 4.5.
The extension method GetStableHashCode is now available also on ReadOnlySpan<char> on all supported platforms except .NET Framework 4.0.
The enum value HashType.AlphaNumericNoCase is now marked as obsolete and has a replacement in HashType.AlphaNumericIgnoreCase.