From 2c8a76ac1989c88de96f12f4cba1bf5646c54bd0 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 17:55:02 -0700 Subject: [PATCH 01/71] Update ReflectionHelper.cs with refurbished instance creaters Signed-off-by: Xen --- HashifyNet/Core/Utilities/ReflectionHelper.cs | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/HashifyNet/Core/Utilities/ReflectionHelper.cs b/HashifyNet/Core/Utilities/ReflectionHelper.cs index 86afdd0..405a761 100644 --- a/HashifyNet/Core/Utilities/ReflectionHelper.cs +++ b/HashifyNet/Core/Utilities/ReflectionHelper.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -183,7 +183,7 @@ public static ConstructorInfo GetConstructor(this Type type, BindingFlags flags, return retval; } - public static Func CreateInstanceWithParameters(ConstructorInfo ctor, params Type[] parameterTypes) + public static Func CreateInstanceWithParameters(ConstructorInfo ctor, params Type[] parameterTypes) { _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); var argumentsParameter = Expression.Parameter(typeof(object[]), "args"); @@ -195,9 +195,54 @@ public static Func CreateInstanceWithParameters(ConstructorInf }).ToArray(); var newExpression = Expression.New(ctor, parameterExpressions); - var convertExpression = Expression.Convert(newExpression, typeof(object)); + var convertExpression = Expression.Convert(newExpression, typeof(TType)); + + var lambda = Expression.Lambda>(convertExpression, argumentsParameter); + return lambda.Compile(); + } + + public static Func CreateInstanceWithSingleParameter(ConstructorInfo ctor) + { + _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); + + ParameterInfo[] constructorParams = ctor.GetParameters(); + if (constructorParams.Length != 1) + { + throw new ArgumentException("The provided constructor must have exactly one parameter.", nameof(ctor)); + } + + ParameterExpression parameterExpression = Expression.Parameter(typeof(TParameter), "param"); + Expression argumentExpression = parameterExpression; + + Type constructorParamType = constructorParams[0].ParameterType; + if (parameterExpression.Type != constructorParamType) + { + argumentExpression = Expression.Convert(parameterExpression, constructorParamType); + } + + NewExpression newExpression = Expression.New(ctor, argumentExpression); + Expression> lambda; + if (newExpression.Type != typeof(TType)) + { + UnaryExpression convertExpression = Expression.Convert(newExpression, typeof(TType)); + lambda = Expression.Lambda>(convertExpression, parameterExpression); + } + else + { + lambda = Expression.Lambda>(newExpression, parameterExpression); + } + + return lambda.Compile(); + } + + public static Func CreateInstance(ConstructorInfo ctor) + { + _ = ctor ?? throw new ArgumentNullException(nameof(ctor)); + + var newExpression = Expression.New(ctor); + var convertExpression = Expression.Convert(newExpression, typeof(TType)); - var lambda = Expression.Lambda>(convertExpression, argumentsParameter); + var lambda = Expression.Lambda>(convertExpression); return lambda.Compile(); } From 9344509ec8c56b3f1ca897c2fcd5b6a060897ba8 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 03:55:42 +0300 Subject: [PATCH 02/71] Add config profile attributes Signed-off-by: Xen --- .../Attributes/HashConfigProfileAttribute.cs | 58 +++++++++++++ .../Attributes/HashConfigProfilesAttribute.cs | 83 +++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs create mode 100644 HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs diff --git a/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs new file mode 100644 index 0000000..d07e8f9 --- /dev/null +++ b/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet.Core +{ + /// + /// Marks a class as a standard, discoverable hash configuration. + /// + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + internal sealed class HashConfigProfileAttribute : Attribute + { + public string Name { get; } + public string Description { get; } + + public HashConfigProfileAttribute(string name, string description = null +#if NET8_0_OR_GREATER + ! +#endif + ) + { + if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); + } + + Name = name; + Description = description; + } + } +} diff --git a/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs b/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs new file mode 100644 index 0000000..dc9b784 --- /dev/null +++ b/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs @@ -0,0 +1,83 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core.Utilities; +using System; + +namespace HashifyNet.Core +{ + /// + /// Specifies the configuration profile types associated with a class. + /// + /// This attribute is used to associate one or more configuration profile types with a class. Each + /// specified type must meet the following criteria: It must be a non-abstract + /// class. It must be marked with the . It must implement the interface. + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + internal sealed class ConfigProfilesAttribute : Attribute + { + public Type[] ProfileTypes { get; } + public ConfigProfilesAttribute(params Type[] profileTypes) + { + ProfileTypes = profileTypes ?? throw new ArgumentNullException(nameof(profileTypes)); + + foreach (Type t in ProfileTypes) + { + if (t == null) + { + throw new ArgumentException($"{nameof(profileTypes)} must not contain null values.", nameof(profileTypes)); + } + if (!t.IsClass) + { + throw new ArgumentException($"{nameof(profileTypes)} must only contain class types.", nameof(profileTypes)); + } + if (t.IsAbstract) + { + throw new ArgumentException($"{nameof(profileTypes)} must not contain abstract class types.", nameof(profileTypes)); + } + + if (!Attribute.IsDefined(t, typeof(HashConfigProfileAttribute), false)) + { + throw new ArgumentException($"{nameof(profileTypes)} must only contain types marked with {nameof(HashConfigProfileAttribute)}.", nameof(profileTypes)); + } + + if (!t.HasInterface(typeof(IHashConfigBase))) + { + throw new ArgumentException($"{nameof(profileTypes)} must only contain types implementing {nameof(IHashConfigBase)}.", nameof(profileTypes)); + } + + if (!t.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 0)) + { + throw new ArgumentException($"{nameof(profileTypes)} must only contain types with a public parameterless constructor.", nameof(profileTypes)); + } + } + } + } +} From dc936d9f871dff788444a46ce4b56f5bb595683a Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 04:00:03 +0300 Subject: [PATCH 03/71] Add config profile class and interface Signed-off-by: Xen --- HashifyNet/Core/Config/HashConfigProfile.cs | 58 ++++++++++++++++++++ HashifyNet/Core/Config/IHashConfigProfile.cs | 53 ++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 HashifyNet/Core/Config/HashConfigProfile.cs create mode 100644 HashifyNet/Core/Config/IHashConfigProfile.cs diff --git a/HashifyNet/Core/Config/HashConfigProfile.cs b/HashifyNet/Core/Config/HashConfigProfile.cs new file mode 100644 index 0000000..b991d2b --- /dev/null +++ b/HashifyNet/Core/Config/HashConfigProfile.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet +{ + internal sealed class HashConfigProfile : IHashConfigProfile + { + public string Name { get; } + public string Description { get; } + + private Func _profileFactory; + public HashConfigProfile(string name, string description, Func profileFactory) + { + if (string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("The profile name must be a non-empty string.", nameof(name)); + } + if (profileFactory == null) + { + throw new ArgumentNullException(nameof(profileFactory), "The profile factory function cannot be null."); + } + + Name = name; + Description = description; + _profileFactory = profileFactory; + } + + public IHashConfigBase Create() => _profileFactory(); + } +} diff --git a/HashifyNet/Core/Config/IHashConfigProfile.cs b/HashifyNet/Core/Config/IHashConfigProfile.cs new file mode 100644 index 0000000..a40aeee --- /dev/null +++ b/HashifyNet/Core/Config/IHashConfigProfile.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +namespace HashifyNet +{ + /// + /// Represents a configuration profile for a hash algorithm. + /// + public interface IHashConfigProfile + { + /// + /// Gets the name of the underlying config profile. + /// + string Name { get; } + + /// + /// Gets the description of the underlying config profile. This may be . + /// + string Description { get; } + + /// + /// Creates an instance of the underlying config profile. + /// + /// An instance of representing the configuration profile. + IHashConfigBase Create(); + } +} From b6f7e85071c12366aa476df3ffccad58e6c27025 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:01:48 -0700 Subject: [PATCH 04/71] Refactor HashFactory to include config profiles and way better lambdas Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 81 ++++++++++++++++---------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index d882feb..b1918f7 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -27,6 +27,7 @@ // ****************************************************************************** // * +using HashifyNet.Core; using HashifyNet.Core.Utilities; using System; using System.Collections; @@ -60,8 +61,9 @@ private static HashFactory Singleton } } - private static readonly Hashtable _concreteConfigTypes; private static readonly Hashtable _implementations; + private static readonly Hashtable _concreteConfigTypes; + private static readonly Hashtable _configProfiles; /// /// Initializes the static state of the class by discovering and registering available hash /// algorithm implementations. @@ -79,14 +81,15 @@ static HashFactory() { _implementations = new Hashtable(); _concreteConfigTypes = new Hashtable(); + _configProfiles = new Hashtable(); - Type[] types = ReflectionHelper.GetClasses(typeof(Core.HashAlgorithmImplementationAttribute), false); + Type[] types = ReflectionHelper.GetClasses(typeof(HashAlgorithmImplementationAttribute), false); if (types == null || types.Length < 1) { throw new InvalidOperationException("No hash algorithm implementations found."); } - List> validTypes = new List>(); + List> validTypes = new List>(); foreach (Type type in types) { if (type.GetCustomAttribute() != null) @@ -94,31 +97,18 @@ static HashFactory() continue; } - IEnumerable attrs = type.GetCustomAttributes(false); - if (attrs == null) - { - continue; - } - - bool exists = false; - foreach (Core.HashAlgorithmImplementationAttribute attr in attrs) - { - exists = true; - break; - } - - if (!exists) + HashAlgorithmImplementationAttribute implementationAttribute = type.GetCustomAttribute(false); + if (implementationAttribute == null) { continue; } - if (!type.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) })) + if (!type.HasConstructor(BindingFlags.Public | BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) })) { continue; } - Core.HashAlgorithmImplementationAttribute implattr = attrs.ElementAt(0); - validTypes.Add(new Tuple(type, implattr)); + validTypes.Add(new Tuple(type, implementationAttribute)); } if (validTypes.Count < 1) @@ -126,24 +116,55 @@ static HashFactory() throw new InvalidOperationException("No valid hash algorithm implementations found."); } - foreach (Tuple t in validTypes) + foreach (Tuple t in validTypes) { - ConstructorInfo factoryCtor = t.Item1.GetConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) }); - Func factory = ReflectionHelper.CreateInstanceWithParameters(factoryCtor, factoryCtor.GetParameters()[0].ParameterType); + ConstructorInfo factoryCtor = t.Item1.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 1, new Type[] { typeof(IHashConfigBase) }); + Func factory = ReflectionHelper.CreateInstanceWithSingleParameter(factoryCtor); Type configType = t.Item2.ConcreteConfig; _concreteConfigTypes.Add(t.Item2.ImplementedInterface, configType); + ConfigProfilesAttribute configProfilesAttribute = configType.GetCustomAttribute(false); + if (configProfilesAttribute != null) + { + // This assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. + IHashConfigProfile[] factories = new IHashConfigProfile[configProfilesAttribute.ProfileTypes.Length]; + for (int i = 0; i < configProfilesAttribute.ProfileTypes.Length; ++i) + { + Type configProfileType = configProfilesAttribute.ProfileTypes[i]; + ConstructorInfo configProfileCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); + if (configProfileCtor == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' does not have a public parameterless constructor. This should not have happened in normal cases, so it probably points to a bug."); + } + + HashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); + if (configProfileAttribute == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(HashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); + } + + Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); + factories[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); + } + + _configProfiles.Add(t.Item2.ImplementedInterface, factories); + } + // If the concrete config has no parameterless constructor, we cannot create a default instance. In this case, the parameterless Create function will throw. - Func configFactory = null; + Func configFactory = null; ConstructorInfo configCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); if (configCtor != null) { - configFactory = ReflectionHelper.CreateInstanceWithParameters(configCtor); + configFactory = ReflectionHelper.CreateInstance(configCtor); } - _implementations.Add(t.Item2.ImplementedInterface, Tuple.Create, Func>(factory, configFactory)); + _implementations.Add(t.Item2.ImplementedInterface, Tuple.Create, Func>(factory, configFactory)); } } @@ -181,13 +202,13 @@ public IHashFunctionBase CreateInstance(Type type) throw new NotImplementedException($"No implementation found for type {type.FullName}."); } - Tuple, Func> factory = (Tuple, Func>)_implementations[type]; + Tuple, Func> factory = (Tuple, Func>)_implementations[type]; if (factory.Item2 == null) { throw new NotImplementedException($"No default configuration available for type {type.FullName}."); } - return (IHashFunctionBase)factory.Item1(new object[] { factory.Item2(null) }); + return factory.Item1(factory.Item2()); } /// @@ -226,8 +247,8 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) throw new NotImplementedException($"No implementation found for type {type.FullName}."); } - Tuple, Func> factory = (Tuple, Func>)_implementations[type]; - return (IHashFunctionBase)factory.Item1(new object[] { config }); + Tuple, Func> factory = (Tuple, Func>)_implementations[type]; + return factory.Item1(config); } } } From 58265dc0f1fb28bbcdd5ef631bce8d902e51b035 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:02:19 -0700 Subject: [PATCH 05/71] Update _implementations access in Hash Factory Extensions Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.Extensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.Extensions.cs b/HashifyNet/Core/Factory/HashFactory.Extensions.cs index a32d827..21db3a9 100644 --- a/HashifyNet/Core/Factory/HashFactory.Extensions.cs +++ b/HashifyNet/Core/Factory/HashFactory.Extensions.cs @@ -200,13 +200,13 @@ public static IHashConfigBase CreateDefaultConcreteConfig(Type type) throw new KeyNotFoundException($"No implementation registered for type '{type.FullName}'."); } - Func configFactory = ((Tuple, Func>)_implementations[type]).Item2; + Func configFactory = ((Tuple, Func>)_implementations[type]).Item2; if (configFactory == null) { throw new NotSupportedException($"No default configuration available for type '{type.FullName}'."); } - return (IHashConfigBase)configFactory(null); + return configFactory(); } /// From 92d3ba1ced2e902e00d88923c111067a8e808a49 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:09:23 -0700 Subject: [PATCH 06/71] Rename ConfigProfilesAttribute to HashConfigProfilesAttribute Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index b1918f7..3d97f8b 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -125,7 +125,7 @@ static HashFactory() _concreteConfigTypes.Add(t.Item2.ImplementedInterface, configType); - ConfigProfilesAttribute configProfilesAttribute = configType.GetCustomAttribute(false); + HashConfigProfilesAttribute configProfilesAttribute = configType.GetCustomAttribute(false); if (configProfilesAttribute != null) { // This assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. From 75140d1f5dcc4a092cec6e87ab3f6bbd270c146e Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:10:03 -0700 Subject: [PATCH 07/71] Rename ConfigProfilesAttribute to HashConfigProfilesAttribute Signed-off-by: Xen --- HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs b/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs index dc9b784..c9a7244 100644 --- a/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs +++ b/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -41,10 +41,10 @@ namespace HashifyNet.Core /// cref="HashConfigProfileAttribute"/>. It must implement the interface. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] - internal sealed class ConfigProfilesAttribute : Attribute + internal sealed class HashConfigProfilesAttribute : Attribute { public Type[] ProfileTypes { get; } - public ConfigProfilesAttribute(params Type[] profileTypes) + public HashConfigProfilesAttribute(params Type[] profileTypes) { ProfileTypes = profileTypes ?? throw new ArgumentNullException(nameof(profileTypes)); From 043e3f39abe06da6ff0a27b2144a18d7ca183539 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:19:58 -0700 Subject: [PATCH 08/71] Delete HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs Signed-off-by: Xen --- .../Attributes/HashConfigProfilesAttribute.cs | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs diff --git a/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs b/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs deleted file mode 100644 index c9a7244..0000000 --- a/HashifyNet/Core/Attributes/HashConfigProfilesAttribute.cs +++ /dev/null @@ -1,83 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the ""Software""), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using HashifyNet.Core.Utilities; -using System; - -namespace HashifyNet.Core -{ - /// - /// Specifies the configuration profile types associated with a class. - /// - /// This attribute is used to associate one or more configuration profile types with a class. Each - /// specified type must meet the following criteria: It must be a non-abstract - /// class. It must be marked with the . It must implement the interface. - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] - internal sealed class HashConfigProfilesAttribute : Attribute - { - public Type[] ProfileTypes { get; } - public HashConfigProfilesAttribute(params Type[] profileTypes) - { - ProfileTypes = profileTypes ?? throw new ArgumentNullException(nameof(profileTypes)); - - foreach (Type t in ProfileTypes) - { - if (t == null) - { - throw new ArgumentException($"{nameof(profileTypes)} must not contain null values.", nameof(profileTypes)); - } - if (!t.IsClass) - { - throw new ArgumentException($"{nameof(profileTypes)} must only contain class types.", nameof(profileTypes)); - } - if (t.IsAbstract) - { - throw new ArgumentException($"{nameof(profileTypes)} must not contain abstract class types.", nameof(profileTypes)); - } - - if (!Attribute.IsDefined(t, typeof(HashConfigProfileAttribute), false)) - { - throw new ArgumentException($"{nameof(profileTypes)} must only contain types marked with {nameof(HashConfigProfileAttribute)}.", nameof(profileTypes)); - } - - if (!t.HasInterface(typeof(IHashConfigBase))) - { - throw new ArgumentException($"{nameof(profileTypes)} must only contain types implementing {nameof(IHashConfigBase)}.", nameof(profileTypes)); - } - - if (!t.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 0)) - { - throw new ArgumentException($"{nameof(profileTypes)} must only contain types with a public parameterless constructor.", nameof(profileTypes)); - } - } - } - } -} From 4175b9305d45361efad86eb041537c67cdab4b95 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 04:20:18 +0300 Subject: [PATCH 09/71] Add files via upload Signed-off-by: Xen --- .../DeclareHashConfigProfileAttribute.cs | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs diff --git a/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs new file mode 100644 index 0000000..41e781e --- /dev/null +++ b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs @@ -0,0 +1,83 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core.Utilities; +using System; + +namespace HashifyNet.Core +{ + /// + /// Specifies the configuration profile types associated with a class. + /// + /// This attribute is used to associate one or more configuration profile types with a class. Each + /// specified type must meet the following criteria: It must be a non-abstract + /// class. It must be marked with the . It must implement the interface. + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + internal sealed class DeclareHashConfigProfileAttribute : Attribute + { + public Type ProfileType { get; } + + public DeclareHashConfigProfileAttribute(Type profileType) + { + if (profileType == null) + { + throw new ArgumentException($"{nameof(profileType)} must not contain null values.", nameof(profileType)); + } + + if (!profileType.IsClass) + { + throw new ArgumentException($"{nameof(profileType)} must only contain class types.", nameof(profileType)); + } + + if (profileType.IsAbstract) + { + throw new ArgumentException($"{nameof(profileType)} must not contain abstract class types.", nameof(profileType)); + } + + if (!Attribute.IsDefined(profileType, typeof(HashConfigProfileAttribute), false)) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types marked with {nameof(HashConfigProfileAttribute)}.", nameof(profileType)); + } + + if (!profileType.HasInterface(typeof(IHashConfigBase))) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types implementing {nameof(IHashConfigBase)}.", nameof(profileType)); + } + + if (!profileType.HasConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance, 0)) + { + throw new ArgumentException($"{nameof(profileType)} must only contain types with a public parameterless constructor.", nameof(profileType)); + } + + ProfileType = profileType; + } + } +} From 79ec1ccdd5cb05aecef3d61f0440fc841fd0c666 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:30:31 -0700 Subject: [PATCH 10/71] Switch config profile attribute implementation to a CLS-Compliant code Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 31 +++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index 3d97f8b..e8f91b3 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -125,14 +125,29 @@ static HashFactory() _concreteConfigTypes.Add(t.Item2.ImplementedInterface, configType); - HashConfigProfilesAttribute configProfilesAttribute = configType.GetCustomAttribute(false); - if (configProfilesAttribute != null) + IEnumerable configProfileDeclarationAttributes = configType.GetCustomAttributes(false); + List configProfileTypes = null; + foreach (DeclareHashConfigProfileAttribute attr in configProfileDeclarationAttributes) { - // This assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. - IHashConfigProfile[] factories = new IHashConfigProfile[configProfilesAttribute.ProfileTypes.Length]; - for (int i = 0; i < configProfilesAttribute.ProfileTypes.Length; ++i) + if (configProfileTypes == null) { - Type configProfileType = configProfilesAttribute.ProfileTypes[i]; + configProfileTypes = new List(); + } + + if (attr != null) + { + // Assuming ProfileType is ensured to be non-null and valid by the attribute's constructor. + configProfileTypes.Add(attr.ProfileType); + } + } + + if (configProfileTypes != null && configProfileTypes.Count > 0) + { + // This implementation assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. + IHashConfigProfile[] profiles = new IHashConfigProfile[configProfileTypes.Count]; + for (int i = 0; i < configProfileTypes.Count; ++i) + { + Type configProfileType = configProfileTypes[i]; ConstructorInfo configProfileCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); if (configProfileCtor == null) { @@ -150,10 +165,10 @@ static HashFactory() } Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); - factories[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); + profiles[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); } - _configProfiles.Add(t.Item2.ImplementedInterface, factories); + _configProfiles.Add(t.Item2.ImplementedInterface, profiles); } // If the concrete config has no parameterless constructor, we cannot create a default instance. In this case, the parameterless Create function will throw. From 92f052ba0813b12626634de5afe90e4495aec5d2 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:31:48 -0700 Subject: [PATCH 11/71] Update attribute references Signed-off-by: Xen --- .../Core/Attributes/DeclareHashConfigProfileAttribute.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs index 41e781e..df84f8f 100644 --- a/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DeclareHashConfigProfileAttribute.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -38,7 +38,7 @@ namespace HashifyNet.Core /// This attribute is used to associate one or more configuration profile types with a class. Each /// specified type must meet the following criteria: It must be a non-abstract /// class. It must be marked with the . It must implement the . It must implement the interface. [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal sealed class DeclareHashConfigProfileAttribute : Attribute @@ -62,9 +62,9 @@ public DeclareHashConfigProfileAttribute(Type profileType) throw new ArgumentException($"{nameof(profileType)} must not contain abstract class types.", nameof(profileType)); } - if (!Attribute.IsDefined(profileType, typeof(HashConfigProfileAttribute), false)) + if (!Attribute.IsDefined(profileType, typeof(DefineHashConfigProfileAttribute), false)) { - throw new ArgumentException($"{nameof(profileType)} must only contain types marked with {nameof(HashConfigProfileAttribute)}.", nameof(profileType)); + throw new ArgumentException($"{nameof(profileType)} must only contain types marked with {nameof(DefineHashConfigProfileAttribute)}.", nameof(profileType)); } if (!profileType.HasInterface(typeof(IHashConfigBase))) From ad56a5e9c9bc20753df653f7618765e835406033 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:32:01 -0700 Subject: [PATCH 12/71] Delete HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs Signed-off-by: Xen --- .../Attributes/HashConfigProfileAttribute.cs | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs diff --git a/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs deleted file mode 100644 index d07e8f9..0000000 --- a/HashifyNet/Core/Attributes/HashConfigProfileAttribute.cs +++ /dev/null @@ -1,58 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the ""Software""), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using System; - -namespace HashifyNet.Core -{ - /// - /// Marks a class as a standard, discoverable hash configuration. - /// - [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] - internal sealed class HashConfigProfileAttribute : Attribute - { - public string Name { get; } - public string Description { get; } - - public HashConfigProfileAttribute(string name, string description = null -#if NET8_0_OR_GREATER - ! -#endif - ) - { - if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) - { - throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); - } - - Name = name; - Description = description; - } - } -} From ad92b7acaa04d21aec54a00b9ec37fbf098271c5 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 04:32:34 +0300 Subject: [PATCH 13/71] Rename HashConfigProfileAttribute to DefineHashConfigProfile Signed-off-by: Xen --- .../DefineHashConfigProfileAttribute.cs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs new file mode 100644 index 0000000..e8a48aa --- /dev/null +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System; + +namespace HashifyNet.Core +{ + /// + /// Marks a class as a standard, discoverable hash configuration. + /// + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + internal sealed class DefineHashConfigProfileAttribute : Attribute + { + public string Name { get; } + public string Description { get; } + + public DefineHashConfigProfileAttribute(string name, string description = null +#if NET8_0_OR_GREATER + ! +#endif + ) + { + if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) + { + throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); + } + + Name = name; + Description = description; + } + } +} From 9f16947686ee49badcba938db580d78104442ab0 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:33:34 -0700 Subject: [PATCH 14/71] Rename HashConfigProfile to DefineHashConfigProfile Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index e8f91b3..ae15b3f 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -156,12 +156,12 @@ static HashFactory() throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' does not have a public parameterless constructor. This should not have happened in normal cases, so it probably points to a bug."); } - HashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); + DefineHashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); if (configProfileAttribute == null) { // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. // Just in case, we throw here. - throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(HashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(DefineHashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); } Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); From 59914f874d8cbe90c84a6c50a79e3d068cf36ccf Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:35:06 -0700 Subject: [PATCH 15/71] Remove redundant usings Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index ae15b3f..386c54e 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -32,7 +32,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Reflection; namespace HashifyNet @@ -267,3 +266,4 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) } } } + From 0f6a7c24e6aa8d4972eb67d18ba01299c0b41969 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:43:51 -0700 Subject: [PATCH 16/71] Add config profile definition attribute Signed-off-by: Xen --- HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs index a13192f..55e5846 100644 --- a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs @@ -35,6 +35,7 @@ namespace HashifyNet.Algorithms.BuzHash /// /// Defines a default configuration for a implementation. /// + [DefineHashConfigProfile("Default", "Default configuration for Buz Hash.")] public class DefaultBuzHashConfig : IBuzHashConfig { @@ -163,3 +164,4 @@ public IBuzHashConfig Clone() => }; } } + From 0a27ebff075d30478eccef3e99b91de9fca85548 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:44:11 -0700 Subject: [PATCH 17/71] Add config declaration attribute Signed-off-by: Xen --- HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs index e2334a7..71d305e 100644 --- a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs @@ -36,6 +36,7 @@ namespace HashifyNet.Algorithms.BuzHash /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(DefaultBuzHashConfig))] public class BuzHashConfig : IBuzHashConfig { @@ -94,3 +95,4 @@ public IBuzHashConfig Clone() => }; } } + From 69b039f2591a112a1a55e5e1211c5e232b25c397 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:45:18 -0700 Subject: [PATCH 18/71] Update BuzHashConfig with correct usings and comments Signed-off-by: Xen --- HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs index 71d305e..4b50ad2 100644 --- a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs @@ -27,7 +27,7 @@ // ****************************************************************************** // * -using System; +using HashifyNet.Core; using System.Collections.Generic; using System.Linq; @@ -36,7 +36,7 @@ namespace HashifyNet.Algorithms.BuzHash /// /// Defines a configuration for a implementation. /// - [DeclareHashConfigProfile(typeof(DefaultBuzHashConfig))] + [DeclareHashConfigProfile(typeof(DefaultBuzHashConfig))] public class BuzHashConfig : IBuzHashConfig { @@ -66,7 +66,7 @@ public class BuzHashConfig /// The seed value. /// /// - /// Defaults to 0 + /// Defaults to 0L /// public long Seed { get; set; } @@ -95,4 +95,3 @@ public IBuzHashConfig Clone() => }; } } - From 947119e02a9326510ee0579009cba2e52080f5c4 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:46:06 -0700 Subject: [PATCH 19/71] Update using directives Signed-off-by: Xen --- HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs index 55e5846..c091d02 100644 --- a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs @@ -27,8 +27,9 @@ // ****************************************************************************** // * -using System.Linq; +using HashifyNet.Core; using System.Collections.Generic; +using System.Linq; namespace HashifyNet.Algorithms.BuzHash { @@ -164,4 +165,3 @@ public IBuzHashConfig Clone() => }; } } - From fda335d5884f8e2d42a2f295ebc4f3dc8ad8de9c Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:48:43 -0700 Subject: [PATCH 20/71] Add config profile definition attribute Signed-off-by: Xen --- HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs b/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs index d02d7b6..d4a26a7 100644 --- a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs +++ b/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs @@ -28,6 +28,7 @@ // * using System.Collections.Generic; +using HashifyNet.Core; namespace HashifyNet.Algorithms.Pearson { @@ -41,6 +42,7 @@ namespace HashifyNet.Algorithms.Pearson /// There is nothing special about this configuration's lookup table that makes it explicitly /// better or worse than other valid lookup tables. /// + [DefineHashConfigProfile("Wikipedia", "Specifically contains a configuration for Pearson hashing using the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21.")] public class WikipediaPearsonConfig : IPearsonConfig { @@ -92,4 +94,4 @@ public IPearsonConfig Clone() => HashSizeInBits = HashSizeInBits }; } -} \ No newline at end of file +} From f4657c94ee348f4cc95aeb0b4aaacf5977f0cf2e Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:49:32 -0700 Subject: [PATCH 21/71] Add config profile declaration attribute Signed-off-by: Xen --- HashifyNet/Algorithms/Pearson/PearsonConfig.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs index dc62ba2..e4f25a7 100644 --- a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs +++ b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs @@ -29,12 +29,14 @@ using System.Collections.Generic; using System.Linq; +using HashifyNet.Core; namespace HashifyNet.Algorithms.Pearson { /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(WikipediaPearsonConfig))] public class PearsonConfig : IPearsonConfig { @@ -65,4 +67,4 @@ public IPearsonConfig Clone() => HashSizeInBits = HashSizeInBits }; } -} \ No newline at end of file +} From a70d9dced56767fcaf64b45015dd051f10b85c66 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:53:52 -0700 Subject: [PATCH 22/71] Enhance DefineHashConfigProfileAttribute with length checks Added validation for name and description length in DefineHashConfigProfileAttribute. Signed-off-by: Xen --- .../DefineHashConfigProfileAttribute.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs index e8a48aa..96e5188 100644 --- a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -37,6 +37,9 @@ namespace HashifyNet.Core [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal sealed class DefineHashConfigProfileAttribute : Attribute { + private const int MaxNameLength = 255; + private const int MaxDescriptionLength = 2048; + public string Name { get; } public string Description { get; } @@ -51,6 +54,16 @@ public DefineHashConfigProfileAttribute(string name, string description = null throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); } + if (name.Length > MaxNameLength) + { + throw new ArgumentException($"The config profile name must not exceed {MaxNameLength} characters in length.", nameof(name)); + } + + if (description != null && description.Length > MaxDescriptionLength) + { + throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length.", nameof(description)); + } + Name = name; Description = description; } From 026e1f58e8fbefeb968dc5e97024e3ea88ce1555 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 18:55:04 -0700 Subject: [PATCH 23/71] Reduce max name length in DefineHashConfigProfileAttribute Updated maximum name length from 255 to 64 characters. Signed-off-by: Xen --- HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs index 96e5188..8b6ce6d 100644 --- a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -37,7 +37,7 @@ namespace HashifyNet.Core [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal sealed class DefineHashConfigProfileAttribute : Attribute { - private const int MaxNameLength = 255; + private const int MaxNameLength = 64; private const int MaxDescriptionLength = 2048; public string Name { get; } @@ -69,3 +69,4 @@ public DefineHashConfigProfileAttribute(string name, string description = null } } } + From 54c158238e464273900059fe1bbf11de3561989e Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 19:25:48 -0700 Subject: [PATCH 24/71] Enhance validation for DefineHashConfigProfileAttribute Updated validation rules for Name and Description properties to include minimum length requirements. Signed-off-by: Xen --- .../DefineHashConfigProfileAttribute.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs index 8b6ce6d..279074d 100644 --- a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -37,7 +37,9 @@ namespace HashifyNet.Core [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal sealed class DefineHashConfigProfileAttribute : Attribute { + private const int MinNameLength = 4; private const int MaxNameLength = 64; + private const int MinDescriptionLength = 32; private const int MaxDescriptionLength = 2048; public string Name { get; } @@ -54,14 +56,27 @@ public DefineHashConfigProfileAttribute(string name, string description = null throw new ArgumentException("The config profile name must be a non-empty and non-whitespace string.", nameof(name)); } + if (name.Length < MinNameLength) + { + throw new ArgumentException($"The config profile name must be at least {MinNameLength} characters in length.", nameof(name)); + } + if (name.Length > MaxNameLength) { throw new ArgumentException($"The config profile name must not exceed {MaxNameLength} characters in length.", nameof(name)); } - if (description != null && description.Length > MaxDescriptionLength) + if (description != null) { - throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length.", nameof(description)); + if (description.Length < MinDescriptionLength) + { + throw new ArgumentException($"The config profile description must be at least {MinDescriptionLength} characters in length.", nameof(description)); + } + + if (description.Length > MaxDescriptionLength) + { + throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length.", nameof(description)); + } } Name = name; @@ -69,4 +84,3 @@ public DefineHashConfigProfileAttribute(string name, string description = null } } } - From 7ffc8388ffa5bf0fbd0fe3375cdc8d473a9bae9b Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 19:49:55 -0700 Subject: [PATCH 25/71] Refactor Argon2idConfig with new attributes Signed-off-by: Xen --- .../Algorithms/Argon2id/Argon2idConfig.cs | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs index 6380dee..b5870c1 100644 --- a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs +++ b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -27,6 +27,7 @@ // ****************************************************************************** // * +using HashifyNet.Core; using HashifyNet.Core.Utilities; namespace HashifyNet.Algorithms.Argon2id @@ -37,38 +38,11 @@ namespace HashifyNet.Algorithms.Argon2id /// This class provides properties to configure the behavior of the Argon2id algorithm, including /// memory usage, iteration count, and parallelism. It also includes predefined configurations recommended by OWASP and /// IETF RFC 9106 for various use cases, such as memory-constrained or high-memory systems. + [DeclareHashConfigProfile(typeof(Argon2idConfigOWASP))] + [DeclareHashConfigProfile(typeof(Argon2idConfigIETFLowMemory))] + [DeclareHashConfigProfile(typeof(Argon2idConfigIETFHighMemory))] public class Argon2idConfig : IArgon2idConfig { - /// - /// A secure baseline recommended by OWASP. - /// - public static IArgon2idConfig OWASP_Standard => new Argon2idConfig() - { - MemorySize = 19456, // 19 MiB - Iterations = 2, - DegreeOfParallelism = 1, - }.Clone(); - - /// - /// A strong recommendation from IETF RFC 9106 for memory-constrained systems. - /// - public static IArgon2idConfig IETF_LowMemory => new Argon2idConfig() - { - MemorySize = 65536, // 64 MiB - Iterations = 3, - DegreeOfParallelism = 4, - }.Clone(); - - /// - /// A very strong recommendation from IETF RFC 9106 for systems with ample memory. - /// - public static IArgon2idConfig IETF_HighMemory => new Argon2idConfig() - { - MemorySize = 2097152, // 2 GiB - Iterations = 1, - DegreeOfParallelism = 4, - }.Clone(); - /// /// /// From 4293375bcad2dc024d376c736c54ca652bc17fe2 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 05:50:17 +0300 Subject: [PATCH 26/71] Add Argon2id Config Profiles Signed-off-by: Xen --- .../Argon2idConfigIETFHighMemory.cs | 64 +++++++++++++++++++ .../Argon2idConfigIETFLowMemory.cs | 60 +++++++++++++++++ .../ConfigProfiles/Argon2idConfigOWASP.cs | 60 +++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs new file mode 100644 index 0000000..d46050b --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs @@ -0,0 +1,64 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory + /// usage in compliance with IETF recommendations. + /// + /// This configuration is tailored for scenarios where high memory availability is prioritized to + /// enhance resistance against memory-hard attacks. The default settings are: + /// : 2 GiB (2097152 KiB) : 1 : + /// 4 These values are suitable for environments requiring strong security guarantees and + /// where memory resources are not constrained. + [DefineHashConfigProfile("IETF/HighMemory", "Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory usage in compliance with IETF recommendations.")] + public sealed class Argon2idConfigIETFHighMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for high memory usage. + /// + /// This configuration is designed to comply with the IETF Argon2id recommendations for high memory + /// usage scenarios. The default values are: : 2 GiB + /// (2097152 KiB) : 1 + /// : 4 These defaults are suitable + /// for environments where memory availability is high and security requirements prioritize resistance to memory-hard + /// attacks. + public Argon2idConfigIETFHighMemory() + { + MemorySize = 2097152; // 2 GiB + Iterations = 1; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs new file mode 100644 index 0000000..2bbbba9 --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF + /// recommended settings. + /// + /// This configuration is designed for scenarios where memory usage is constrained, while still + /// maintaining a balance between security and performance. It sets the memory size to 64 MiB, the number of iterations + /// to 3, and the degree of parallelism to 4. + [DefineHashConfigProfile("IETF/LowMemory", "Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF recommended settings.")] + public sealed class Argon2idConfigIETFLowMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for low memory usage. + /// + /// This constructor sets the following default values: : 64 MiB (65536 KiB) : + /// 3 : 4 These + /// defaults are suitable for environments with constrained memory resources while maintaining reasonable security and + /// performance. + public Argon2idConfigIETFLowMemory() + { + MemorySize = 65536; // 64 MiB + Iterations = 3; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs new file mode 100644 index 0000000..b19d674 --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, + /// iterations, and parallelism. + /// + /// This configuration is designed to balance security and performance based on OWASP guidelines. It + /// sets the memory size to 19 MiB, the number of iterations to 2, and the degree of parallelism to 1. These values are + /// suitable for most general-purpose applications but may need adjustment for specific use cases or + /// environments. + [DefineHashConfigProfile("OWASP", "Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, iterations, and parallelism.")] + public sealed class Argon2idConfigOWASP : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration values + /// recommended by the OWASP Password Storage Cheat Sheet. + /// + /// The default configuration values are: : 19 MiB (19456 KiB). : + /// 2. : 1. + /// These values are suitable for environments with limited resources while maintaining reasonable security. + public Argon2idConfigOWASP() + { + MemorySize = 19456; // 19 MiB + Iterations = 2; + DegreeOfParallelism = 1; + } + } +} From ea6db14dd32c0731491cc36b1343b56d6e64d10c Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 19:53:21 -0700 Subject: [PATCH 27/71] Delete HashifyNet/Algorithms/Argon2id/ConfigProfiles directory Signed-off-by: Xen --- .../Argon2idConfigIETFHighMemory.cs | 64 ------------------- .../Argon2idConfigIETFLowMemory.cs | 60 ----------------- .../ConfigProfiles/Argon2idConfigOWASP.cs | 60 ----------------- 3 files changed, 184 deletions(-) delete mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs delete mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs delete mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs deleted file mode 100644 index d46050b..0000000 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFHighMemory.cs +++ /dev/null @@ -1,64 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the ""Software""), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using HashifyNet.Core; - -namespace HashifyNet.Algorithms.Argon2id -{ - /// - /// Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory - /// usage in compliance with IETF recommendations. - /// - /// This configuration is tailored for scenarios where high memory availability is prioritized to - /// enhance resistance against memory-hard attacks. The default settings are: - /// : 2 GiB (2097152 KiB) : 1 : - /// 4 These values are suitable for environments requiring strong security guarantees and - /// where memory resources are not constrained. - [DefineHashConfigProfile("IETF/HighMemory", "Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory usage in compliance with IETF recommendations.")] - public sealed class Argon2idConfigIETFHighMemory : Argon2idConfig - { - /// - /// Initializes a new instance of the class with default configuration - /// values optimized for high memory usage. - /// - /// This configuration is designed to comply with the IETF Argon2id recommendations for high memory - /// usage scenarios. The default values are: : 2 GiB - /// (2097152 KiB) : 1 - /// : 4 These defaults are suitable - /// for environments where memory availability is high and security requirements prioritize resistance to memory-hard - /// attacks. - public Argon2idConfigIETFHighMemory() - { - MemorySize = 2097152; // 2 GiB - Iterations = 1; - DegreeOfParallelism = 4; - } - } -} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs deleted file mode 100644 index 2bbbba9..0000000 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigIETFLowMemory.cs +++ /dev/null @@ -1,60 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the ""Software""), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using HashifyNet.Core; - -namespace HashifyNet.Algorithms.Argon2id -{ - /// - /// Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF - /// recommended settings. - /// - /// This configuration is designed for scenarios where memory usage is constrained, while still - /// maintaining a balance between security and performance. It sets the memory size to 64 MiB, the number of iterations - /// to 3, and the degree of parallelism to 4. - [DefineHashConfigProfile("IETF/LowMemory", "Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF recommended settings.")] - public sealed class Argon2idConfigIETFLowMemory : Argon2idConfig - { - /// - /// Initializes a new instance of the class with default configuration - /// values optimized for low memory usage. - /// - /// This constructor sets the following default values: : 64 MiB (65536 KiB) : - /// 3 : 4 These - /// defaults are suitable for environments with constrained memory resources while maintaining reasonable security and - /// performance. - public Argon2idConfigIETFLowMemory() - { - MemorySize = 65536; // 64 MiB - Iterations = 3; - DegreeOfParallelism = 4; - } - } -} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs deleted file mode 100644 index b19d674..0000000 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigOWASP.cs +++ /dev/null @@ -1,60 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the ""Software""), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using HashifyNet.Core; - -namespace HashifyNet.Algorithms.Argon2id -{ - /// - /// Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, - /// iterations, and parallelism. - /// - /// This configuration is designed to balance security and performance based on OWASP guidelines. It - /// sets the memory size to 19 MiB, the number of iterations to 2, and the degree of parallelism to 1. These values are - /// suitable for most general-purpose applications but may need adjustment for specific use cases or - /// environments. - [DefineHashConfigProfile("OWASP", "Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, iterations, and parallelism.")] - public sealed class Argon2idConfigOWASP : Argon2idConfig - { - /// - /// Initializes a new instance of the class with default configuration values - /// recommended by the OWASP Password Storage Cheat Sheet. - /// - /// The default configuration values are: : 19 MiB (19456 KiB). : - /// 2. : 1. - /// These values are suitable for environments with limited resources while maintaining reasonable security. - public Argon2idConfigOWASP() - { - MemorySize = 19456; // 19 MiB - Iterations = 2; - DegreeOfParallelism = 1; - } - } -} From de18278af318e8c5ab338b98857b65abafa8c16c Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 05:53:43 +0300 Subject: [PATCH 28/71] Rename Argon2idConfig defaults to include "Profile" in name Signed-off-by: Xen --- .../Argon2idConfigProfileIETFHighMemory.cs | 64 +++++++++++++++++++ .../Argon2idConfigProfileIETFLowMemory.cs | 60 +++++++++++++++++ .../Argon2idConfigProfileOWASP.cs | 60 +++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs create mode 100644 HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs new file mode 100644 index 0000000..d46050b --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs @@ -0,0 +1,64 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory + /// usage in compliance with IETF recommendations. + /// + /// This configuration is tailored for scenarios where high memory availability is prioritized to + /// enhance resistance against memory-hard attacks. The default settings are: + /// : 2 GiB (2097152 KiB) : 1 : + /// 4 These values are suitable for environments requiring strong security guarantees and + /// where memory resources are not constrained. + [DefineHashConfigProfile("IETF/HighMemory", "Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory usage in compliance with IETF recommendations.")] + public sealed class Argon2idConfigIETFHighMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for high memory usage. + /// + /// This configuration is designed to comply with the IETF Argon2id recommendations for high memory + /// usage scenarios. The default values are: : 2 GiB + /// (2097152 KiB) : 1 + /// : 4 These defaults are suitable + /// for environments where memory availability is high and security requirements prioritize resistance to memory-hard + /// attacks. + public Argon2idConfigIETFHighMemory() + { + MemorySize = 2097152; // 2 GiB + Iterations = 1; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs new file mode 100644 index 0000000..2bbbba9 --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF + /// recommended settings. + /// + /// This configuration is designed for scenarios where memory usage is constrained, while still + /// maintaining a balance between security and performance. It sets the memory size to 64 MiB, the number of iterations + /// to 3, and the degree of parallelism to 4. + [DefineHashConfigProfile("IETF/LowMemory", "Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF recommended settings.")] + public sealed class Argon2idConfigIETFLowMemory : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration + /// values optimized for low memory usage. + /// + /// This constructor sets the following default values: : 64 MiB (65536 KiB) : + /// 3 : 4 These + /// defaults are suitable for environments with constrained memory resources while maintaining reasonable security and + /// performance. + public Argon2idConfigIETFLowMemory() + { + MemorySize = 65536; // 64 MiB + Iterations = 3; + DegreeOfParallelism = 4; + } + } +} diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs new file mode 100644 index 0000000..b19d674 --- /dev/null +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs @@ -0,0 +1,60 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Argon2id +{ + /// + /// Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, + /// iterations, and parallelism. + /// + /// This configuration is designed to balance security and performance based on OWASP guidelines. It + /// sets the memory size to 19 MiB, the number of iterations to 2, and the degree of parallelism to 1. These values are + /// suitable for most general-purpose applications but may need adjustment for specific use cases or + /// environments. + [DefineHashConfigProfile("OWASP", "Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, iterations, and parallelism.")] + public sealed class Argon2idConfigOWASP : Argon2idConfig + { + /// + /// Initializes a new instance of the class with default configuration values + /// recommended by the OWASP Password Storage Cheat Sheet. + /// + /// The default configuration values are: : 19 MiB (19456 KiB). : + /// 2. : 1. + /// These values are suitable for environments with limited resources while maintaining reasonable security. + public Argon2idConfigOWASP() + { + MemorySize = 19456; // 19 MiB + Iterations = 2; + DegreeOfParallelism = 1; + } + } +} From 1a354f7b1026c3214d238adfbf7f073bb37e9f09 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 05:54:53 +0300 Subject: [PATCH 29/71] Repush previous commit Signed-off-by: Xen --- .../ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs | 6 +++--- .../ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs | 6 +++--- .../Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs index d46050b..f25d7e8 100644 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFHighMemory.cs @@ -42,10 +42,10 @@ namespace HashifyNet.Algorithms.Argon2id /// 4 These values are suitable for environments requiring strong security guarantees and /// where memory resources are not constrained. [DefineHashConfigProfile("IETF/HighMemory", "Represents a predefined configuration profile for the Argon2id key derivation function, optimized for high memory usage in compliance with IETF recommendations.")] - public sealed class Argon2idConfigIETFHighMemory : Argon2idConfig + public sealed class Argon2idConfigProfileIETFHighMemory : Argon2idConfig { /// - /// Initializes a new instance of the class with default configuration + /// Initializes a new instance of the class with default configuration /// values optimized for high memory usage. /// /// This configuration is designed to comply with the IETF Argon2id recommendations for high memory @@ -54,7 +54,7 @@ public sealed class Argon2idConfigIETFHighMemory : Argon2idConfig /// : 4 These defaults are suitable /// for environments where memory availability is high and security requirements prioritize resistance to memory-hard /// attacks. - public Argon2idConfigIETFHighMemory() + public Argon2idConfigProfileIETFHighMemory() { MemorySize = 2097152; // 2 GiB Iterations = 1; diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs index 2bbbba9..053891a 100644 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileIETFLowMemory.cs @@ -39,10 +39,10 @@ namespace HashifyNet.Algorithms.Argon2id /// maintaining a balance between security and performance. It sets the memory size to 64 MiB, the number of iterations /// to 3, and the degree of parallelism to 4. [DefineHashConfigProfile("IETF/LowMemory", "Represents a preconfigured Argon2id hashing configuration optimized for low memory usage, adhering to the IETF recommended settings.")] - public sealed class Argon2idConfigIETFLowMemory : Argon2idConfig + public sealed class Argon2idConfigProfileIETFLowMemory : Argon2idConfig { /// - /// Initializes a new instance of the class with default configuration + /// Initializes a new instance of the class with default configuration /// values optimized for low memory usage. /// /// This constructor sets the following default values: : 4 These /// defaults are suitable for environments with constrained memory resources while maintaining reasonable security and /// performance. - public Argon2idConfigIETFLowMemory() + public Argon2idConfigProfileIETFLowMemory() { MemorySize = 65536; // 64 MiB Iterations = 3; diff --git a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs index b19d674..e55a85f 100644 --- a/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs +++ b/HashifyNet/Algorithms/Argon2id/ConfigProfiles/Argon2idConfigProfileOWASP.cs @@ -40,17 +40,17 @@ namespace HashifyNet.Algorithms.Argon2id /// suitable for most general-purpose applications but may need adjustment for specific use cases or /// environments. [DefineHashConfigProfile("OWASP", "Provides a preconfigured Argon2id hashing configuration that adheres to the OWASP recommendations for memory, iterations, and parallelism.")] - public sealed class Argon2idConfigOWASP : Argon2idConfig + public sealed class Argon2idConfigProfileOWASP : Argon2idConfig { /// - /// Initializes a new instance of the class with default configuration values + /// Initializes a new instance of the class with default configuration values /// recommended by the OWASP Password Storage Cheat Sheet. /// /// The default configuration values are: : 19 MiB (19456 KiB). : /// 2. : 1. /// These values are suitable for environments with limited resources while maintaining reasonable security. - public Argon2idConfigOWASP() + public Argon2idConfigProfileOWASP() { MemorySize = 19456; // 19 MiB Iterations = 2; From a9cd38f1c0a8d99ee510ebff1edb322714d67907 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 19:55:59 -0700 Subject: [PATCH 30/71] Update Argon2id default configs to include Profile in their names Signed-off-by: Xen --- HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs index b5870c1..0ae3fac 100644 --- a/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs +++ b/HashifyNet/Algorithms/Argon2id/Argon2idConfig.cs @@ -38,9 +38,9 @@ namespace HashifyNet.Algorithms.Argon2id /// This class provides properties to configure the behavior of the Argon2id algorithm, including /// memory usage, iteration count, and parallelism. It also includes predefined configurations recommended by OWASP and /// IETF RFC 9106 for various use cases, such as memory-constrained or high-memory systems. - [DeclareHashConfigProfile(typeof(Argon2idConfigOWASP))] - [DeclareHashConfigProfile(typeof(Argon2idConfigIETFLowMemory))] - [DeclareHashConfigProfile(typeof(Argon2idConfigIETFHighMemory))] + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileOWASP))] + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileIETFLowMemory))] + [DeclareHashConfigProfile(typeof(Argon2idConfigProfileIETFHighMemory))] public class Argon2idConfig : IArgon2idConfig { /// From 8b4a0e8487d593e3b4bc2b514ffbb70e299a6ac8 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 19:59:01 -0700 Subject: [PATCH 31/71] Delete HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs Signed-off-by: Xen --- .../BuzHash/DefaultBuzHashConfig.cs | 167 ------------------ 1 file changed, 167 deletions(-) delete mode 100644 HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs diff --git a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs deleted file mode 100644 index c091d02..0000000 --- a/HashifyNet/Algorithms/BuzHash/DefaultBuzHashConfig.cs +++ /dev/null @@ -1,167 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the "Software"), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using HashifyNet.Core; -using System.Collections.Generic; -using System.Linq; - -namespace HashifyNet.Algorithms.BuzHash -{ - /// - /// Defines a default configuration for a implementation. - /// - [DefineHashConfigProfile("Default", "Default configuration for Buz Hash.")] - public class DefaultBuzHashConfig - : IBuzHashConfig - { - /// - /// Gets a list of 256 (preferably random and distinct) values. - /// - /// - /// List of 256 values. - /// - /// - /// Defaults to a statically defined, random chosen of values. - /// - public IReadOnlyList Rtab { get; } = _Rtab.Select(u => unchecked((long)u)).ToArray(); - - /// - /// Gets the desired hash size, in bits. - /// - /// - /// The desired hash size, in bits. - /// - /// - /// Defaults to 64. - /// - public int HashSizeInBits { get; set; } = 64; - - /// - /// Gets the seed value. - /// - /// - /// The seed value. - /// - /// - /// Defaults to 0x3CD05367FD0337D3UL - /// - public long Seed { get; set; } = 0x3CD05367FD0337D3L; - - /// - /// Gets the shift direction. - /// - /// - /// The shift direction. - /// - /// - /// Defaults to . - /// - public CircularShiftDirection ShiftDirection { get; set; } = CircularShiftDirection.Left; - - private static readonly IReadOnlyList _Rtab = - new ulong[] { - 0xBDBF3FFFDEEF8A14, 0xFFB5AC3C0DB31F7F, 0x7BF7207BF73C4D2E, 0xADBFFF96358377F6, - 0xC6BF8D442C4FD166, 0x7EB1EFF12B7D81F9, 0x88024802AB9F22C2, 0x2191221208E98495, - 0xA9377F55EBA6AE60, 0x2954721569FD66AE, 0xB109C13854720646, 0x42088A01BE975A1D, - 0xF92FE5C643CB474B, 0x1B2600A8603CFEFB, 0x02042A11B642620A, 0x96FD78D6F98DE9FF, - 0x84C3BDFE7BAD886C, 0x202340C0CB5918DE, 0x008203C342B3CF21, 0xC3C62DBEDC433FFB, - 0xD5DDB64C2474A600, 0x804A3380F7DF01A1, 0x39C3FDE506D02ADA, 0xB84CE5F2BF804325, - 0x7716EAD9F1EBD693, 0x7BE96E7C939FDDFD, 0x4BBF845D8D01114A, 0xBCF70EF509FF5BE4, - 0x09304628A16326F9, 0xBAFC7E1FE7095D14, 0x024C1200E0750521, 0xEF3D2EEFFD0D8818, - 0x4ECEAF0C5599E3FA, 0x09428020FE781238, 0x6800083E30A844BF, 0x484DDBF62CB950D3, - 0xB3B267F53AED1920, 0x63DD7C51D0A92E3E, 0xFD550CE7A53E5761, 0x7D5F99FEB7925A09, - 0x0992330C5BDF740E, 0x990000406A727796, 0xD7A4DFFC9FCA57B4, 0xF59AFCC43B30F4C3, - 0x7D5EBE76D1D24BDF, 0xA2A4FB1AEC2EC537, 0xAFC0B6CF3E03025C, 0xE208702CF499C9CB, - 0x75CA6F4F0C8A4DDC, 0xF8F9F878D66754FF, 0x3FF75EF5C1DE3053, 0x53BAE3A5A905128B, - 0xB1BFDF70CC0F7112, 0x135EEF7C7A3E8DF8, 0xD8ACF95E8BA1C9D2, 0xDBD5602734815B77, - 0x1023920CDF4C139A, 0xA7E6DB1D67C9AD76, 0x0D128006E457F2B3, 0x0C2C21E104548FC8, - 0x018C802135E0A3BC, 0x081288411A14E549, 0x6AD9EE993380DF74, 0xF5AF72D81916A3C6, - 0x000701006AAA31A2, 0x2A000458E11A3187, 0xF92ED72D3391382F, 0xD7CD5769816E75DA, - 0xE0A20891B6B62235, 0xD94FFF5957AC4B63, 0xDEFE79E0A2EB8EAA, 0x8F25868005B09923, - 0x47FB033FF9ACC364, 0xD6FFBE2BB9D0CE96, 0x29822E20DA779D26, 0x52321C00BBD3AB35, - 0x40284B9D8DF33680, 0x0029D1201309A49C, 0x0144368AA5DF9E71, 0xFF2FB62F52C3EFCC, - 0x81000C00A538674F, 0x02F5E5EFBF3DAF09, 0xC80840A55A62254B, 0x6EF951BA5CD0BBA5, - 0xF7AAEAFE40C20D99, 0xE87431B3F39C0F58, 0x75BFB3DBC936C0DA, 0x2C0082B1060FA821, - 0x86230011152586B6, 0xB4DB5ABDAB01FABB, 0xE692EF3BD281D8A7, 0x2F35B2DB521E4CCD, - 0x30540540CD3DD3D2, 0x0011D0145B0DA5B8, 0x7980408459603ECD, 0x9D85FFF7D5473E44, - 0x8091CA3229D981C5, 0xB937FDA194197B12, 0x678EDBE160935014, 0x001200A0AF993605, - 0x0A161200FE13B420, 0x8B64FD762D57B8D1, 0xFBDC643D65C00E0A, 0x21FAFB67DE23714C, - 0xF513404C2D74183A, 0x5C3EDDDD898EB496, 0x080D01A1A8230EF2, 0x8A0842444891281C, - 0xB3E4BF87382225C6, 0xFB5CDEF580CE7B8F, 0x3EF149D8574CD77A, 0xBDB935C57B90774C, - 0x9EE6DF5E6FC3B84A, 0x28008C81B519AF29, 0x7D7D92CED4EE9DD5, 0x481100110D6BC434, - 0x7B9FE78BDC3511E1, 0x04F40862682DF110, 0x01980E0927A6C110, 0xC3FCFDF6913A463A, - 0xEF49CE170BD3C001, 0xFF6B35E4DCC47200, 0x000054C062F8ECA4, 0xD6AD0BEB45A1FD23, - 0x86E8176870686CFD, 0xA6575169D427B781, 0x3EFE91FC06ED42FA, 0xF647FDEF1AE7BEAD, - 0x8F8FFBAC78DE6DE9, 0x030044210AE13603, 0xEC9A921E694A7BA9, 0x0B36808222DA2D65, - 0x5F79DFB292EA3274, 0x6F9AF3B345025EB2, 0xE7D5FAB26C70D599, 0x35EBDF7D7E0A72D3, - 0x000030606D945BD8, 0x79BEF77FC0B62B01, 0xD9D7335E57195393, 0x720001E8BEBF825C, - 0x4F1BED5F746DCDFC, 0xFFF71737877AA9F6, 0xBFD76BD3C5EA90B6, 0x06FE7FDBD130FC88, - 0x669E67F7B2C3E024, 0xC62280A8BC600D30, 0xF37246153F29409B, 0x1C00A01C604CC6F5, - 0x5F9F345A437264A3, 0x40014082BA0C8473, 0xE4F6BE368A35C987, 0xEF49BCDF20BDD1CE, - 0x00832E81621989C6, 0xDA4DD8B58BCCB9A9, 0xF4D3BF1353F98FE5, 0x53C06D0880747E6D, - 0x5F727E631FF49D3B, 0xF632FBFA5CE0CFD5, 0x028E6C010B3BE280, 0xB2EF73BD6BF434C8, - 0xE6DD2AE316501406, 0xBEFA64FF447E843D, 0xCFFDEC3BB4F8FE4D, 0x1A20217BCC57E881, - 0x01400946DE76AED7, 0xEB73B7775ECED509, 0x80F88E40AF1DF242, 0xD6DD0DD37A550A3F, - 0xC04508102A640CED, 0xA9EEF6DD658B9CEB, 0x85E7D7CE9789F3B6, 0xFEFFB9CB109FF8B6, - 0x6E7F17325A7077F9, 0xDB8491CFE1D4ED2B, 0x014A3002CEC42B3B, 0x777BD6741774E035, - 0xAEF77407616C8E0A, 0x26B4650FDFAC5B9D, 0xF579B0D397D4D773, 0xF4F93F9F522459EA, - 0x84342AC460578177, 0x3413ADFA27401535, 0xDF7FDBBB9DA14F2C, 0x5D9AA44FAC77B715, - 0x55FFFB3E816757A1, 0xBDFD576FBE620C15, 0x9EF25F9D4425F446, 0x98F91EAF6E2B7D02, - 0xBC4E91C76196E2FA, 0xC3EAC7F6F588504F, 0xCFC8F6FE5A663BBB, 0xA0882023307FC824, - 0xB5F6BBEB8CC3D194, 0x61EF3DB74DF56CF2, 0x9C00C0082FB16792, 0xFC71D9117C3C0422, - 0x28FEDFFDA66087A9, 0x358F0242116E9145, 0x8502A48CDF1E3E21, 0x410D03A4CA7A8FC0, - 0x35E3EBDD0CA338FB, 0x40201300FC29816F, 0x14C01500D25B560E, 0x800A00114EF4E934, - 0x1E09EDCFA816C60E, 0xC0E1D51F506FEAFB, 0x6B6FD5BF28BCBA5C, 0x102004027457305E, - 0x4620E1C8EF6E5CC7, 0x02444A4F08D7BD5C, 0x3E2EBB7839012427, 0x5590548E9F4AAC57, - 0xC2D6DA6FB0802DA9, 0x02330010E0BB92DA, 0x7ED90FEF79CDF8CB, 0x385AE04F3D98B02E, - 0xD67FB42AF49EC23D, 0x2FC76EFDDD5E3F4E, 0xE00200B016D33664, 0x9A77F8BBB782695B, - 0x5FEDD3D936A38378, 0xDF19F3ABA42B7C80, 0xFEF0867CD9D9686A, 0xBD19C875A298FB90, - 0x10E68FAB7965C3CD, 0x67F98FFACE95BBAC, 0xF73D99FFD24CA24F, 0xBFED3FBA8DB66C93, - 0x08200592E7DF255F, 0x0A7B317FB02CC8C1, 0x9A4902118F501102, 0xCB751DEA3EE6F295, - 0xB4D93AB7657FD5D6, 0x7107FE6CF610F16D, 0x5F6CD7DA898AA310, 0xD8061C819850A37E, - 0x20D302209ADAA873, 0x18CF44768221A077, 0x7FABEB8FC42E75ED, 0xF7F73DCE13E65789, - 0x64000410838268FE, 0xFEE1D93637319A58, 0xA7186FE743AE37DC, 0x3B2F380F590F5AFD, - 0x30C1A0C0CB03AAA9, 0x00080D88746C14B5, 0xD4B1FBDE8B376876, 0x2004200247C5DB47, - 0xDD645E45898E166D, 0x80000D38B28D2BC0, 0xF7ADA101A6F34F0F, 0x04404000A27DB2F2, - 0x7B79E1EC83874C2A, 0x6B2FFD2662DA5E68, 0xCF3EEBA20B383BCE, 0x4503C00A838F9989 - }; - - /// - /// Makes a deep clone of the current instance. - /// - /// A deep clone of the current instance. - public IBuzHashConfig Clone() => - new DefaultBuzHashConfig() - { - HashSizeInBits = HashSizeInBits, - Seed = Seed, - ShiftDirection = ShiftDirection - }; - } -} From b8c37392d4214aa452cc037488b460a4d2c9d3b6 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 05:59:26 +0300 Subject: [PATCH 32/71] Rename DefaultBuzHashConfig Signed-off-by: Xen --- .../BuzHash/BuzHashConfigProfileDefault.cs | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs new file mode 100644 index 0000000..8acf92a --- /dev/null +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs @@ -0,0 +1,167 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the "Software"), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Collections.Generic; +using System.Linq; + +namespace HashifyNet.Algorithms.BuzHash +{ + /// + /// Defines a default configuration for a implementation. + /// + [DefineHashConfigProfile("Default", "Default configuration for Buz Hash.")] + public class BuzHashConfigProfileDefault + : IBuzHashConfig + { + /// + /// Gets a list of 256 (preferably random and distinct) values. + /// + /// + /// List of 256 values. + /// + /// + /// Defaults to a statically defined, random chosen of values. + /// + public IReadOnlyList Rtab { get; } = _Rtab.Select(u => unchecked((long)u)).ToArray(); + + /// + /// Gets the desired hash size, in bits. + /// + /// + /// The desired hash size, in bits. + /// + /// + /// Defaults to 64. + /// + public int HashSizeInBits { get; set; } = 64; + + /// + /// Gets the seed value. + /// + /// + /// The seed value. + /// + /// + /// Defaults to 0x3CD05367FD0337D3UL + /// + public long Seed { get; set; } = 0x3CD05367FD0337D3L; + + /// + /// Gets the shift direction. + /// + /// + /// The shift direction. + /// + /// + /// Defaults to . + /// + public CircularShiftDirection ShiftDirection { get; set; } = CircularShiftDirection.Left; + + private static readonly IReadOnlyList _Rtab = + new ulong[] { + 0xBDBF3FFFDEEF8A14, 0xFFB5AC3C0DB31F7F, 0x7BF7207BF73C4D2E, 0xADBFFF96358377F6, + 0xC6BF8D442C4FD166, 0x7EB1EFF12B7D81F9, 0x88024802AB9F22C2, 0x2191221208E98495, + 0xA9377F55EBA6AE60, 0x2954721569FD66AE, 0xB109C13854720646, 0x42088A01BE975A1D, + 0xF92FE5C643CB474B, 0x1B2600A8603CFEFB, 0x02042A11B642620A, 0x96FD78D6F98DE9FF, + 0x84C3BDFE7BAD886C, 0x202340C0CB5918DE, 0x008203C342B3CF21, 0xC3C62DBEDC433FFB, + 0xD5DDB64C2474A600, 0x804A3380F7DF01A1, 0x39C3FDE506D02ADA, 0xB84CE5F2BF804325, + 0x7716EAD9F1EBD693, 0x7BE96E7C939FDDFD, 0x4BBF845D8D01114A, 0xBCF70EF509FF5BE4, + 0x09304628A16326F9, 0xBAFC7E1FE7095D14, 0x024C1200E0750521, 0xEF3D2EEFFD0D8818, + 0x4ECEAF0C5599E3FA, 0x09428020FE781238, 0x6800083E30A844BF, 0x484DDBF62CB950D3, + 0xB3B267F53AED1920, 0x63DD7C51D0A92E3E, 0xFD550CE7A53E5761, 0x7D5F99FEB7925A09, + 0x0992330C5BDF740E, 0x990000406A727796, 0xD7A4DFFC9FCA57B4, 0xF59AFCC43B30F4C3, + 0x7D5EBE76D1D24BDF, 0xA2A4FB1AEC2EC537, 0xAFC0B6CF3E03025C, 0xE208702CF499C9CB, + 0x75CA6F4F0C8A4DDC, 0xF8F9F878D66754FF, 0x3FF75EF5C1DE3053, 0x53BAE3A5A905128B, + 0xB1BFDF70CC0F7112, 0x135EEF7C7A3E8DF8, 0xD8ACF95E8BA1C9D2, 0xDBD5602734815B77, + 0x1023920CDF4C139A, 0xA7E6DB1D67C9AD76, 0x0D128006E457F2B3, 0x0C2C21E104548FC8, + 0x018C802135E0A3BC, 0x081288411A14E549, 0x6AD9EE993380DF74, 0xF5AF72D81916A3C6, + 0x000701006AAA31A2, 0x2A000458E11A3187, 0xF92ED72D3391382F, 0xD7CD5769816E75DA, + 0xE0A20891B6B62235, 0xD94FFF5957AC4B63, 0xDEFE79E0A2EB8EAA, 0x8F25868005B09923, + 0x47FB033FF9ACC364, 0xD6FFBE2BB9D0CE96, 0x29822E20DA779D26, 0x52321C00BBD3AB35, + 0x40284B9D8DF33680, 0x0029D1201309A49C, 0x0144368AA5DF9E71, 0xFF2FB62F52C3EFCC, + 0x81000C00A538674F, 0x02F5E5EFBF3DAF09, 0xC80840A55A62254B, 0x6EF951BA5CD0BBA5, + 0xF7AAEAFE40C20D99, 0xE87431B3F39C0F58, 0x75BFB3DBC936C0DA, 0x2C0082B1060FA821, + 0x86230011152586B6, 0xB4DB5ABDAB01FABB, 0xE692EF3BD281D8A7, 0x2F35B2DB521E4CCD, + 0x30540540CD3DD3D2, 0x0011D0145B0DA5B8, 0x7980408459603ECD, 0x9D85FFF7D5473E44, + 0x8091CA3229D981C5, 0xB937FDA194197B12, 0x678EDBE160935014, 0x001200A0AF993605, + 0x0A161200FE13B420, 0x8B64FD762D57B8D1, 0xFBDC643D65C00E0A, 0x21FAFB67DE23714C, + 0xF513404C2D74183A, 0x5C3EDDDD898EB496, 0x080D01A1A8230EF2, 0x8A0842444891281C, + 0xB3E4BF87382225C6, 0xFB5CDEF580CE7B8F, 0x3EF149D8574CD77A, 0xBDB935C57B90774C, + 0x9EE6DF5E6FC3B84A, 0x28008C81B519AF29, 0x7D7D92CED4EE9DD5, 0x481100110D6BC434, + 0x7B9FE78BDC3511E1, 0x04F40862682DF110, 0x01980E0927A6C110, 0xC3FCFDF6913A463A, + 0xEF49CE170BD3C001, 0xFF6B35E4DCC47200, 0x000054C062F8ECA4, 0xD6AD0BEB45A1FD23, + 0x86E8176870686CFD, 0xA6575169D427B781, 0x3EFE91FC06ED42FA, 0xF647FDEF1AE7BEAD, + 0x8F8FFBAC78DE6DE9, 0x030044210AE13603, 0xEC9A921E694A7BA9, 0x0B36808222DA2D65, + 0x5F79DFB292EA3274, 0x6F9AF3B345025EB2, 0xE7D5FAB26C70D599, 0x35EBDF7D7E0A72D3, + 0x000030606D945BD8, 0x79BEF77FC0B62B01, 0xD9D7335E57195393, 0x720001E8BEBF825C, + 0x4F1BED5F746DCDFC, 0xFFF71737877AA9F6, 0xBFD76BD3C5EA90B6, 0x06FE7FDBD130FC88, + 0x669E67F7B2C3E024, 0xC62280A8BC600D30, 0xF37246153F29409B, 0x1C00A01C604CC6F5, + 0x5F9F345A437264A3, 0x40014082BA0C8473, 0xE4F6BE368A35C987, 0xEF49BCDF20BDD1CE, + 0x00832E81621989C6, 0xDA4DD8B58BCCB9A9, 0xF4D3BF1353F98FE5, 0x53C06D0880747E6D, + 0x5F727E631FF49D3B, 0xF632FBFA5CE0CFD5, 0x028E6C010B3BE280, 0xB2EF73BD6BF434C8, + 0xE6DD2AE316501406, 0xBEFA64FF447E843D, 0xCFFDEC3BB4F8FE4D, 0x1A20217BCC57E881, + 0x01400946DE76AED7, 0xEB73B7775ECED509, 0x80F88E40AF1DF242, 0xD6DD0DD37A550A3F, + 0xC04508102A640CED, 0xA9EEF6DD658B9CEB, 0x85E7D7CE9789F3B6, 0xFEFFB9CB109FF8B6, + 0x6E7F17325A7077F9, 0xDB8491CFE1D4ED2B, 0x014A3002CEC42B3B, 0x777BD6741774E035, + 0xAEF77407616C8E0A, 0x26B4650FDFAC5B9D, 0xF579B0D397D4D773, 0xF4F93F9F522459EA, + 0x84342AC460578177, 0x3413ADFA27401535, 0xDF7FDBBB9DA14F2C, 0x5D9AA44FAC77B715, + 0x55FFFB3E816757A1, 0xBDFD576FBE620C15, 0x9EF25F9D4425F446, 0x98F91EAF6E2B7D02, + 0xBC4E91C76196E2FA, 0xC3EAC7F6F588504F, 0xCFC8F6FE5A663BBB, 0xA0882023307FC824, + 0xB5F6BBEB8CC3D194, 0x61EF3DB74DF56CF2, 0x9C00C0082FB16792, 0xFC71D9117C3C0422, + 0x28FEDFFDA66087A9, 0x358F0242116E9145, 0x8502A48CDF1E3E21, 0x410D03A4CA7A8FC0, + 0x35E3EBDD0CA338FB, 0x40201300FC29816F, 0x14C01500D25B560E, 0x800A00114EF4E934, + 0x1E09EDCFA816C60E, 0xC0E1D51F506FEAFB, 0x6B6FD5BF28BCBA5C, 0x102004027457305E, + 0x4620E1C8EF6E5CC7, 0x02444A4F08D7BD5C, 0x3E2EBB7839012427, 0x5590548E9F4AAC57, + 0xC2D6DA6FB0802DA9, 0x02330010E0BB92DA, 0x7ED90FEF79CDF8CB, 0x385AE04F3D98B02E, + 0xD67FB42AF49EC23D, 0x2FC76EFDDD5E3F4E, 0xE00200B016D33664, 0x9A77F8BBB782695B, + 0x5FEDD3D936A38378, 0xDF19F3ABA42B7C80, 0xFEF0867CD9D9686A, 0xBD19C875A298FB90, + 0x10E68FAB7965C3CD, 0x67F98FFACE95BBAC, 0xF73D99FFD24CA24F, 0xBFED3FBA8DB66C93, + 0x08200592E7DF255F, 0x0A7B317FB02CC8C1, 0x9A4902118F501102, 0xCB751DEA3EE6F295, + 0xB4D93AB7657FD5D6, 0x7107FE6CF610F16D, 0x5F6CD7DA898AA310, 0xD8061C819850A37E, + 0x20D302209ADAA873, 0x18CF44768221A077, 0x7FABEB8FC42E75ED, 0xF7F73DCE13E65789, + 0x64000410838268FE, 0xFEE1D93637319A58, 0xA7186FE743AE37DC, 0x3B2F380F590F5AFD, + 0x30C1A0C0CB03AAA9, 0x00080D88746C14B5, 0xD4B1FBDE8B376876, 0x2004200247C5DB47, + 0xDD645E45898E166D, 0x80000D38B28D2BC0, 0xF7ADA101A6F34F0F, 0x04404000A27DB2F2, + 0x7B79E1EC83874C2A, 0x6B2FFD2662DA5E68, 0xCF3EEBA20B383BCE, 0x4503C00A838F9989 + }; + + /// + /// Makes a deep clone of the current instance. + /// + /// A deep clone of the current instance. + public IBuzHashConfig Clone() => + new BuzHashConfigProfileDefault() + { + HashSizeInBits = HashSizeInBits, + Seed = Seed, + ShiftDirection = ShiftDirection + }; + } +} \ No newline at end of file From 67b00afc0f5b81c267ba1194f418db8b29415f87 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:00:03 -0700 Subject: [PATCH 33/71] Rename DefaultBuzHashConfig Signed-off-by: Xen --- HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs index 4b50ad2..d862a84 100644 --- a/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfig.cs @@ -36,7 +36,7 @@ namespace HashifyNet.Algorithms.BuzHash /// /// Defines a configuration for a implementation. /// - [DeclareHashConfigProfile(typeof(DefaultBuzHashConfig))] + [DeclareHashConfigProfile(typeof(BuzHashConfigProfileDefault))] public class BuzHashConfig : IBuzHashConfig { From 32a4a96f01c2f3c2bc45ba3f6d90583da66e6039 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:01:56 -0700 Subject: [PATCH 34/71] Delete HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs Signed-off-by: Xen --- .../Pearson/WikipediaPearsonConfig.cs | 97 ------------------- 1 file changed, 97 deletions(-) delete mode 100644 HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs diff --git a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs b/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs deleted file mode 100644 index d4a26a7..0000000 --- a/HashifyNet/Algorithms/Pearson/WikipediaPearsonConfig.cs +++ /dev/null @@ -1,97 +0,0 @@ -// * -// ***************************************************************************** -// * -// * Copyright (c) 2025 Deskasoft International -// * -// * Permission is hereby granted, free of charge, to any person obtaining a copy -// * of this software and associated documentation files (the "Software"), to deal -// * in the Software without restriction, including without limitation the rights -// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// * copies of the Software, and to permit persons to whom the Software is -// * furnished to do so, subject to the following conditions: -// * -// * The above copyright notice and this permission notice shall be included in all -// * copies or substantial portions of the Software. -// * -// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// * SOFTWARE. -// * -// * -// * Please refer to LICENSE file. -// * -// ****************************************************************************** -// * - -using System.Collections.Generic; -using HashifyNet.Core; - -namespace HashifyNet.Algorithms.Pearson -{ - /// - /// Defines a configuration for a implementation. - /// - /// Specifically contains a configuration for Pearson hashing using the lookup table - /// given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21. - /// - /// - /// There is nothing special about this configuration's lookup table that makes it explicitly - /// better or worse than other valid lookup tables. - /// - [DefineHashConfigProfile("Wikipedia", "Specifically contains a configuration for Pearson hashing using the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21.")] - public class WikipediaPearsonConfig - : IPearsonConfig - { - /// - /// A 256-length lookup table that is a defined permutation of [0, 255]. - /// - /// - /// The table. - /// - /// - /// Uses the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21. - /// - public IReadOnlyList Table { get; } = _table; - - /// - /// Gets the desired hash size, in bits. - /// - /// - /// The desired hash size, in bits. - /// - public int HashSizeInBits { get; set; } = 8; - - private static readonly IReadOnlyList _table = new byte[] { - 98, 6, 85, 150, 36, 23, 112, 164, 135, 207, 169, 5, 26, 64, 165, 219, // 1 - 61, 20, 68, 89, 130, 63, 52, 102, 24, 229, 132, 245, 80, 216, 195, 115, // 2 - 90, 168, 156, 203, 177, 120, 2, 190, 188, 7, 100, 185, 174, 243, 162, 10, // 3 - 237, 18, 253, 225, 8, 208, 172, 244, 255, 126, 101, 79, 145, 235, 228, 121, // 4 - 123, 251, 67, 250, 161, 0, 107, 97, 241, 111, 181, 82, 249, 33, 69, 55, // 5 - 59, 153, 29, 9, 213, 167, 84, 93, 30, 46, 94, 75, 151, 114, 73, 222, // 6 - 197, 96, 210, 45, 16, 227, 248, 202, 51, 152, 252, 125, 81, 206, 215, 186, // 7 - 39, 158, 178, 187, 131, 136, 1, 49, 50, 17, 141, 91, 47, 129, 60, 99, // 8 - 154, 35, 86, 171, 105, 34, 38, 200, 147, 58, 77, 118, 173, 246, 76, 254, // 9 - 133, 232, 196, 144, 198, 124, 53, 4, 108, 74, 223, 234, 134, 230, 157, 139, // 10 - 189, 205, 199, 128, 176, 19, 211, 236, 127, 192, 231, 70, 233, 88, 146, 44, // 11 - 183, 201, 22, 83, 13, 214, 116, 109, 159, 32, 95, 226, 140, 220, 57, 12, // 12 - 221, 31, 209, 182, 143, 92, 149, 184, 148, 62, 113, 65, 37, 27, 106, 166, // 13 - 3, 14, 204, 72, 21, 41, 56, 66, 28, 193, 40, 217, 25, 54, 179, 117, // 14 - 238, 87, 240, 155, 180, 170, 242, 212, 191, 163, 78, 218, 137, 194, 175, 110, // 15 - 43, 119, 224, 71, 122, 142, 42, 160, 104, 48, 247, 103, 15, 11, 138, 239 // 16 - }; - - /// - /// Makes a deep clone of current instance. - /// - /// A deep clone of the current instance. - public IPearsonConfig Clone() => - new WikipediaPearsonConfig() - { - HashSizeInBits = HashSizeInBits - }; - } -} From 506d8a1538404c2d7c4599ef0d96bec42f4a717a Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 06:02:18 +0300 Subject: [PATCH 35/71] Rename WikipediaPearsonConfig Signed-off-by: Xen --- .../Pearson/PearsonConfigProfileWikipedia.cs | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs diff --git a/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs new file mode 100644 index 0000000..ac500df --- /dev/null +++ b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs @@ -0,0 +1,97 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the "Software"), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using System.Collections.Generic; +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.Pearson +{ + /// + /// Defines a configuration for a implementation. + /// + /// Specifically contains a configuration for Pearson hashing using the lookup table + /// given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21. + /// + /// + /// There is nothing special about this configuration's lookup table that makes it explicitly + /// better or worse than other valid lookup tables. + /// + [DefineHashConfigProfile("Wikipedia", "Specifically contains a configuration for Pearson hashing using the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21.")] + public class PearsonConfigProfileWikipedia + : IPearsonConfig + { + /// + /// A 256-length lookup table that is a defined permutation of [0, 255]. + /// + /// + /// The table. + /// + /// + /// Uses the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21. + /// + public IReadOnlyList Table { get; } = _table; + + /// + /// Gets the desired hash size, in bits. + /// + /// + /// The desired hash size, in bits. + /// + public int HashSizeInBits { get; set; } = 8; + + private static readonly IReadOnlyList _table = new byte[] { + 98, 6, 85, 150, 36, 23, 112, 164, 135, 207, 169, 5, 26, 64, 165, 219, // 1 + 61, 20, 68, 89, 130, 63, 52, 102, 24, 229, 132, 245, 80, 216, 195, 115, // 2 + 90, 168, 156, 203, 177, 120, 2, 190, 188, 7, 100, 185, 174, 243, 162, 10, // 3 + 237, 18, 253, 225, 8, 208, 172, 244, 255, 126, 101, 79, 145, 235, 228, 121, // 4 + 123, 251, 67, 250, 161, 0, 107, 97, 241, 111, 181, 82, 249, 33, 69, 55, // 5 + 59, 153, 29, 9, 213, 167, 84, 93, 30, 46, 94, 75, 151, 114, 73, 222, // 6 + 197, 96, 210, 45, 16, 227, 248, 202, 51, 152, 252, 125, 81, 206, 215, 186, // 7 + 39, 158, 178, 187, 131, 136, 1, 49, 50, 17, 141, 91, 47, 129, 60, 99, // 8 + 154, 35, 86, 171, 105, 34, 38, 200, 147, 58, 77, 118, 173, 246, 76, 254, // 9 + 133, 232, 196, 144, 198, 124, 53, 4, 108, 74, 223, 234, 134, 230, 157, 139, // 10 + 189, 205, 199, 128, 176, 19, 211, 236, 127, 192, 231, 70, 233, 88, 146, 44, // 11 + 183, 201, 22, 83, 13, 214, 116, 109, 159, 32, 95, 226, 140, 220, 57, 12, // 12 + 221, 31, 209, 182, 143, 92, 149, 184, 148, 62, 113, 65, 37, 27, 106, 166, // 13 + 3, 14, 204, 72, 21, 41, 56, 66, 28, 193, 40, 217, 25, 54, 179, 117, // 14 + 238, 87, 240, 155, 180, 170, 242, 212, 191, 163, 78, 218, 137, 194, 175, 110, // 15 + 43, 119, 224, 71, 122, 142, 42, 160, 104, 48, 247, 103, 15, 11, 138, 239 // 16 + }; + + /// + /// Makes a deep clone of current instance. + /// + /// A deep clone of the current instance. + public IPearsonConfig Clone() => + new PearsonConfigProfileWikipedia() + { + HashSizeInBits = HashSizeInBits + }; + } +} \ No newline at end of file From deaf21517a17365341534fac178d2ecfb596a22d Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:02:51 -0700 Subject: [PATCH 36/71] Rename WikipediaPearsonConfig Signed-off-by: Xen --- HashifyNet/Algorithms/Pearson/PearsonConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs index e4f25a7..f59a89a 100644 --- a/HashifyNet/Algorithms/Pearson/PearsonConfig.cs +++ b/HashifyNet/Algorithms/Pearson/PearsonConfig.cs @@ -36,7 +36,7 @@ namespace HashifyNet.Algorithms.Pearson /// /// Defines a configuration for a implementation. /// - [DeclareHashConfigProfile(typeof(WikipediaPearsonConfig))] + [DeclareHashConfigProfile(typeof(PearsonConfigProfileWikipedia))] public class PearsonConfig : IPearsonConfig { From a14c70e5f2f5776ffd66e92dbbf6f668814a48db Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:07:20 -0700 Subject: [PATCH 37/71] Seal the wikipedia profile of pearson config Signed-off-by: Xen --- .../Algorithms/Pearson/PearsonConfigProfileWikipedia.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs index ac500df..e3179b9 100644 --- a/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs +++ b/HashifyNet/Algorithms/Pearson/PearsonConfigProfileWikipedia.cs @@ -43,7 +43,7 @@ namespace HashifyNet.Algorithms.Pearson /// better or worse than other valid lookup tables. /// [DefineHashConfigProfile("Wikipedia", "Specifically contains a configuration for Pearson hashing using the lookup table given in the article at http://en.wikipedia.org/wiki/Pearson_hashing as of 2014-04-21.")] - public class PearsonConfigProfileWikipedia + public sealed class PearsonConfigProfileWikipedia : IPearsonConfig { /// @@ -94,4 +94,5 @@ public IPearsonConfig Clone() => HashSizeInBits = HashSizeInBits }; } -} \ No newline at end of file + +} From 90876e81dd3db4bb71925734ab50d9efc218073d Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:09:21 -0700 Subject: [PATCH 38/71] Refactor BuzHashConfigProfileDefault class Signed-off-by: Xen --- .../BuzHash/BuzHashConfigProfileDefault.cs | 71 ++++--------------- 1 file changed, 15 insertions(+), 56 deletions(-) diff --git a/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs index 8acf92a..56000f3 100644 --- a/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs +++ b/HashifyNet/Algorithms/BuzHash/BuzHashConfigProfileDefault.cs @@ -37,52 +37,23 @@ namespace HashifyNet.Algorithms.BuzHash /// Defines a default configuration for a implementation. /// [DefineHashConfigProfile("Default", "Default configuration for Buz Hash.")] - public class BuzHashConfigProfileDefault - : IBuzHashConfig + public sealed class BuzHashConfigProfileDefault + : BuzHashConfig { /// - /// Gets a list of 256 (preferably random and distinct) values. + /// Initializes a new instance of the class with default configuration + /// values. /// - /// - /// List of 256 values. - /// - /// - /// Defaults to a statically defined, random chosen of values. - /// - public IReadOnlyList Rtab { get; } = _Rtab.Select(u => unchecked((long)u)).ToArray(); - - /// - /// Gets the desired hash size, in bits. - /// - /// - /// The desired hash size, in bits. - /// - /// - /// Defaults to 64. - /// - public int HashSizeInBits { get; set; } = 64; - - /// - /// Gets the seed value. - /// - /// - /// The seed value. - /// - /// - /// Defaults to 0x3CD05367FD0337D3UL - /// - public long Seed { get; set; } = 0x3CD05367FD0337D3L; - - /// - /// Gets the shift direction. - /// - /// - /// The shift direction. - /// - /// - /// Defaults to . - /// - public CircularShiftDirection ShiftDirection { get; set; } = CircularShiftDirection.Left; + /// This constructor sets up the default configuration for a BuzHash profile, including the hash + /// size, seed value, and circular shift direction. The default values are suitable for general-purpose hashing + /// scenarios. + public BuzHashConfigProfileDefault() + { + Rtab = _Rtab.Select(u => unchecked((long)u)).ToArray(); + HashSizeInBits = 64; + Seed = 0x3CD05367FD0337D3L; + ShiftDirection = CircularShiftDirection.Left; + } private static readonly IReadOnlyList _Rtab = new ulong[] { @@ -151,17 +122,5 @@ public class BuzHashConfigProfileDefault 0xDD645E45898E166D, 0x80000D38B28D2BC0, 0xF7ADA101A6F34F0F, 0x04404000A27DB2F2, 0x7B79E1EC83874C2A, 0x6B2FFD2662DA5E68, 0xCF3EEBA20B383BCE, 0x4503C00A838F9989 }; - - /// - /// Makes a deep clone of the current instance. - /// - /// A deep clone of the current instance. - public IBuzHashConfig Clone() => - new BuzHashConfigProfileDefault() - { - HashSizeInBits = HashSizeInBits, - Seed = Seed, - ShiftDirection = ShiftDirection - }; } -} \ No newline at end of file +} From ce871d46b7b7fb2dc666fbed1f106cdc0358a770 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:25:33 -0700 Subject: [PATCH 39/71] Refactor FNVConfig by adding hash profiles Signed-off-by: Xen --- HashifyNet/Algorithms/FNV/FNVConfig.cs | 78 +++----------------------- 1 file changed, 8 insertions(+), 70 deletions(-) diff --git a/HashifyNet/Algorithms/FNV/FNVConfig.cs b/HashifyNet/Algorithms/FNV/FNVConfig.cs index 5b4abf1..f828f10 100644 --- a/HashifyNet/Algorithms/FNV/FNVConfig.cs +++ b/HashifyNet/Algorithms/FNV/FNVConfig.cs @@ -27,8 +27,7 @@ // ****************************************************************************** // * -using System; -using System.Collections.Generic; +using HashifyNet.Core; using System.Numerics; namespace HashifyNet.Algorithms.FNV @@ -36,6 +35,12 @@ namespace HashifyNet.Algorithms.FNV /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(FNVConfigProfile32Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile64Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile128Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile256Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile512Bits))] + [DeclareHashConfigProfile(typeof(FNVConfigProfile1024Bits))] public class FNVConfig : IFNVConfig { @@ -74,72 +79,5 @@ public IFNVConfig Clone() => Prime = Prime, Offset = Offset }; - - private static readonly IReadOnlyDictionary _predefinedConfigs = - new Dictionary() { - { - 32, - new FNVConfig() { - HashSizeInBits = 32, - Prime = new BigInteger(16777619), - Offset = new BigInteger(2166136261) - } - }, - { - 64, - new FNVConfig() { - HashSizeInBits = 64, - Prime = new BigInteger(1099511628211), - Offset = new BigInteger(14695981039346656037) - } - }, - { - 128, - new FNVConfig() { - HashSizeInBits = 128, - Prime = BigInteger.Parse("309485009821345068724781371"), - Offset = BigInteger.Parse("144066263297769815596495629667062367629") - } - }, - { - 256, - new FNVConfig() { - HashSizeInBits = 256, - Prime = BigInteger.Parse("374144419156711147060143317175368453031918731002211"), - Offset = BigInteger.Parse("100029257958052580907070968620625704837092796014241193945225284501741471925557") - } - }, - { - 512, - new FNVConfig() { - HashSizeInBits = 512, - Prime = BigInteger.Parse("35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759"), - Offset = BigInteger.Parse("9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785") - } - }, - { - 1024, - new FNVConfig() { - HashSizeInBits = 1024, - Prime = BigInteger.Parse("5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573"), - Offset = BigInteger.Parse("14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915") - } - } - }; - - /// - /// Gets one of the predefined configurations as defined at http://www.isthe.com/chongo/tech/comp/fnv/index.html. - /// - /// The desired hash length, in bits. - /// The predefined configuration instance. - public static IFNVConfig GetPredefinedConfig(int hashSizeInBits) - { - if (!_predefinedConfigs.TryGetValue(hashSizeInBits, out var config)) - { - throw new ArgumentOutOfRangeException(nameof(hashSizeInBits), hashSizeInBits, $"{nameof(hashSizeInBits)} must be a positive power of 2 between 32 and 1024."); - } - - return config; - } } -} \ No newline at end of file +} From 1be06d642474071337c9585323b64445b0fb0bf8 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 06:26:07 +0300 Subject: [PATCH 40/71] Add FNV Config Profiles Signed-off-by: Xen --- .../FNVConfigProfile1024Bits.cs | 58 ++++++++++++++++++ .../ConfigProfiles/FNVConfigProfile128Bits.cs | 59 +++++++++++++++++++ .../ConfigProfiles/FNVConfigProfile256Bits.cs | 59 +++++++++++++++++++ .../ConfigProfiles/FNVConfigProfile32Bits.cs | 57 ++++++++++++++++++ .../ConfigProfiles/FNVConfigProfile512Bits.cs | 58 ++++++++++++++++++ .../ConfigProfiles/FNVConfigProfile64Bits.cs | 56 ++++++++++++++++++ 6 files changed, 347 insertions(+) create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs create mode 100644 HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs new file mode 100644 index 0000000..a32b365 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile1024Bits.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the Fowler-Noll-Vo (FNV) hash algorithm with a 1024-bit hash size. + /// + /// This class defines the parameters specific to the 1024-bit variant of the FNV hash algorithm, + /// including the hash size, prime, and offset values. These parameters are pre-defined constants tailored for the + /// 1024-bit configuration. Use this profile when a 1024-bit hash size is required for hashing operations. + [DefineHashConfigProfile("1024Bits", "Represents the configuration profile for the Fowler-Noll-Vo (FNV) hash algorithm with a 1024-bit hash size.")] + public sealed class FNVConfigProfile1024Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the Fowler-Noll-Vo + /// (FNV) hash algorithm for 1024-bit hash size. + /// + /// This constructor sets the hash size to 1024 bits and initializes the prime and offset values used + /// in the FNV-1 hash algorithm. The prime and offset values are pre-defined constants specific to the 1024-bit + /// variant of the algorithm. + public FNVConfigProfile1024Bits() + { + HashSizeInBits = 1024; + Prime = BigInteger.Parse("5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573"); + Offset = BigInteger.Parse("14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs new file mode 100644 index 0000000..b665be8 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile128Bits.cs @@ -0,0 +1,59 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 128-bit Fowler-Noll-Vo (FNV) hash algorithm. + /// + /// This class defines the parameters specific to the 128-bit variant of the FNV-1 and FNV-1a hash + /// algorithms, including the hash size, prime, and offset values. These parameters are based on the standard + /// constants for the 128-bit FNV hash function. Use this class to configure and initialize a hash function + /// that operates with a 128-bit hash size. + [DefineHashConfigProfile("128Bits", "Represents the configuration profile for the 128-bit Fowler-Noll-Vo (FNV) hash algorithm.")] + public sealed class FNVConfigProfile128Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 128-bit Fowler-Noll-Vo hash function. + /// + /// This constructor sets the hash size to 128 bits and initializes the prime and offset values + /// specific to the 128-bit FNV-1/FNV-1a hash algorithm. These values are based on the standard constants defined for + /// the 128-bit variant of the algorithm. + public FNVConfigProfile128Bits() + { + HashSizeInBits = 128; + Prime = BigInteger.Parse("309485009821345068724781371"); + Offset = BigInteger.Parse("144066263297769815596495629667062367629"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs new file mode 100644 index 0000000..ca4fd24 --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile256Bits.cs @@ -0,0 +1,59 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents a predefined configuration profile for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash + /// algorithm. + /// + /// This configuration profile is specifically tailored for computing 256-bit FNV-1 hashes. It defines + /// the hash size, prime, and offset values according to the standard constants for the 256-bit FNV-1 algorithm. Use + /// this class to simplify the setup of hash computations requiring a 256-bit hash size. + [DefineHashConfigProfile("256Bits", "Represents a predefined configuration profile for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash algorithm.")] + public sealed class FNVConfigProfile256Bits : FNVConfig + { + /// + /// Initializes a new instance of the class with predefined settings for a + /// 256-bit FNV-1 hash configuration. + /// + /// This constructor sets the hash size to 256 bits and initializes the prime and offset values to + /// the constants defined for the 256-bit variant of the Fowler-Noll-Vo (FNV-1) hash algorithm. These values are used + /// to configure the hash computation. + public FNVConfigProfile256Bits() + { + HashSizeInBits = 256; + Prime = BigInteger.Parse("374144419156711147060143317175368453031918731002211"); + Offset = BigInteger.Parse("100029257958052580907070968620625704837092796014241193945225284501741471925557"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs new file mode 100644 index 0000000..146162c --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile32Bits.cs @@ -0,0 +1,57 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for a 32-bit FNV (Fowler–Noll–Vo) hash function. + /// + /// This profile defines the parameters for the 32-bit FNV-1 and FNV-1a hash algorithms, including the + /// hash size, prime, and offset values. It is designed for use in scenarios where a 32-bit hash is required, such as + /// checksum calculations or hash-based data structures. + [DefineHashConfigProfile("32Bits", "Represents the configuration profile for a 32-bit FNV (Fowler–Noll–Vo) hash function.")] + public sealed class FNVConfigProfile32Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 32-bit FNV (Fowler–Noll–Vo) hash function. + /// + /// This constructor sets the hash size to 32 bits and initializes the prime and offset values + /// commonly used for the 32-bit FNV-1 and FNV-1a hash algorithms. + public FNVConfigProfile32Bits() + { + HashSizeInBits = 32; + Prime = new BigInteger(16777619); + Offset = new BigInteger(2166136261); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs new file mode 100644 index 0000000..ca29fcf --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile512Bits.cs @@ -0,0 +1,58 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 512-bit FNV-1 hash function. + /// + /// This class defines the parameters specific to the 512-bit variant of the Fowler-Noll-Vo (FNV-1) + /// hash algorithm, including the hash size, prime, and offset values. These parameters are based on the standard + /// specification for 512-bit FNV-1 hashes and are used to configure the hash computation. + [DefineHashConfigProfile("512Bits", "Represents the configuration profile for the 512-bit FNV-1 hash function.")] + public sealed class FNVConfigProfile512Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 512-bit FNV-1 hash function. + /// + /// This constructor sets the hash size to 512 bits and initializes the prime and offset values + /// specific to the 512-bit FNV-1 hash algorithm. These values are used in the computation of the hash and are based + /// on the standard FNV-1 specification for 512-bit hashes. + public FNVConfigProfile512Bits() + { + HashSizeInBits = 512; + Prime = BigInteger.Parse("35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759"); + Offset = BigInteger.Parse("9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785"); + } + } +} diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs new file mode 100644 index 0000000..86fd42a --- /dev/null +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs @@ -0,0 +1,56 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; +using System.Numerics; + +namespace HashifyNet.Algorithms.FNV +{ + /// + /// Represents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm. + /// + /// This class defines the parameters specific to the 64-bit FNV hash algorithm, including the hash + /// size, prime, and offset values. It is a sealed class and cannot be inherited. + [DefineHashConfigProfile("64Bits", "epresents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm.")] + public sealed class FNVConfigProfile64Bits : FNVConfig + { + /// + /// Initializes a new instance of the class, configuring the parameters for a + /// 64-bit FNV (Fowler–Noll–Vo) hash algorithm. + /// + /// This constructor sets the hash size to 64 bits and initializes the prime and offset values + /// specific to the 64-bit variant of the FNV hash algorithm. + public FNVConfigProfile64Bits() + { + HashSizeInBits = 64; + Prime = new BigInteger(1099511628211); + Offset = new BigInteger(14695981039346656037); + } + } +} From 18a930592600c097caba67bce992d9f549704fa5 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:33:20 -0700 Subject: [PATCH 41/71] Cover implementation in scopes for clarity Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index 386c54e..891ba8b 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -142,32 +142,35 @@ static HashFactory() if (configProfileTypes != null && configProfileTypes.Count > 0) { + // Create instances of each config profile type and push them into an array then to the lookup table. // This implementation assumes that HashAlgorithmImplementationAttribute's constructor already ensures a public parameterless constructor for every config profile type. - IHashConfigProfile[] profiles = new IHashConfigProfile[configProfileTypes.Count]; - for (int i = 0; i < configProfileTypes.Count; ++i) { - Type configProfileType = configProfileTypes[i]; - ConstructorInfo configProfileCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); - if (configProfileCtor == null) + IHashConfigProfile[] profiles = new IHashConfigProfile[configProfileTypes.Count]; + for (int i = 0; i < configProfileTypes.Count; ++i) { - // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. - // Just in case, we throw here. - throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' does not have a public parameterless constructor. This should not have happened in normal cases, so it probably points to a bug."); + Type configProfileType = configProfileTypes[i]; + ConstructorInfo configProfileCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); + if (configProfileCtor == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' does not have a public parameterless constructor. This should not have happened in normal cases, so it probably points to a bug."); + } + + DefineHashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); + if (configProfileAttribute == null) + { + // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. + // Just in case, we throw here. + throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(DefineHashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); + } + + Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); + profiles[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); } - DefineHashConfigProfileAttribute configProfileAttribute = configProfileType.GetCustomAttribute(false); - if (configProfileAttribute == null) - { - // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. - // Just in case, we throw here. - throw new InvalidOperationException($"The config profile type '{configProfileType.FullName}' is not marked with {nameof(DefineHashConfigProfileAttribute)}. This should not have happened in normal cases, so it probably points to a bug."); - } - - Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); - profiles[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); + _configProfiles.Add(t.Item2.ImplementedInterface, profiles); } - - _configProfiles.Add(t.Item2.ImplementedInterface, profiles); } // If the concrete config has no parameterless constructor, we cannot create a default instance. In this case, the parameterless Create function will throw. @@ -266,4 +269,3 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) } } } - From 1e36f1ba65dfcf8e9da698b9c55bd04090406f62 Mon Sep 17 00:00:00 2001 From: Xen Date: Tue, 9 Sep 2025 20:35:46 -0700 Subject: [PATCH 42/71] Pad fields Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index 891ba8b..ec434c0 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -63,6 +63,7 @@ private static HashFactory Singleton private static readonly Hashtable _implementations; private static readonly Hashtable _concreteConfigTypes; private static readonly Hashtable _configProfiles; + /// /// Initializes the static state of the class by discovering and registering available hash /// algorithm implementations. @@ -269,3 +270,4 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) } } } + From 529c66134b818a2823e94a2fc9df7cb3badc0612 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:41:01 -0700 Subject: [PATCH 43/71] Move out CRC standards and use profiles Signed-off-by: Xen --- HashifyNet/Algorithms/CRC/CRCConfig.cs | 1357 ++---------------------- 1 file changed, 73 insertions(+), 1284 deletions(-) diff --git a/HashifyNet/Algorithms/CRC/CRCConfig.cs b/HashifyNet/Algorithms/CRC/CRCConfig.cs index d7a848e..a4b4d79 100644 --- a/HashifyNet/Algorithms/CRC/CRCConfig.cs +++ b/HashifyNet/Algorithms/CRC/CRCConfig.cs @@ -27,13 +27,84 @@ // ****************************************************************************** // * -using System; +using HashifyNet.Core; namespace HashifyNet.Algorithms.CRC { /// /// Defines a configuration for a implementation. /// + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC3_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC4_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_EPC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC5_USB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_CDMA2000A))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_CDMA2000B))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC6_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC7))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC7_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_DVBS2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_EBU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ICODE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ITU))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_MAXIM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_ROHC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC8_WCDMA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC10))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC10_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC11))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_3GPP))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC12_DECT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC13_BBC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC14_DARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC15))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC15_MPT1327))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileARC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_AUGCCITT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_BUYPASS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_CCITTFALSE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_CDMA2000))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DDS110))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DECTR))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DECTX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_DNP))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_EN13757))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_GENIBUS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_MAXIM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_MCRF4XX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_RIELLO))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_T10DIF))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_TELEDISK))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_TMS37157))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC16_USB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRCA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileKERMIT))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileMODBUS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileX25))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileXMODEM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24_FLEXRAYA))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC24_FLEXRAYB))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC31_PHILIPS))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_BZIP2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32C))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32D))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_MPEG2))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32_POSIX))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC32Q))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileJAMCRC))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileXFER))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC40_GSM))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64_WE))] + [DeclareHashConfigProfile(typeof(CRCConfigProfileCRC64_XZ))] public class CRCConfig : ICRCConfig { @@ -85,1290 +156,8 @@ public class CRCConfig /// public long XOrOut { get; set; } - #region Standards - - /// - /// Creates an instance of configured to the CRC3_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC3_ROHC => new CRCConfig() - { - HashSizeInBits = 3, - Polynomial = 0x3, - InitialValue = 0x7, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC4_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC4_ITU => new CRCConfig() - { - HashSizeInBits = 4, - Polynomial = 0x3, - InitialValue = 0x0, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_EPC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_EPC => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x09, - InitialValue = 0x09, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_ITU => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x15, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC5_USB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC5_USB => new CRCConfig() - { - HashSizeInBits = 5, - Polynomial = 0x05, - InitialValue = 0x1f, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x1f, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_CDMA2000A standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_CDMA2000A => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x27, - InitialValue = 0x3f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_CDMA2000B standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_CDMA2000B => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x07, - InitialValue = 0x3f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_DARC => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x19, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC6_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC6_ITU => new CRCConfig() - { - HashSizeInBits = 6, - Polynomial = 0x03, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC7 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC7 => new CRCConfig() - { - HashSizeInBits = 7, - Polynomial = 0x09, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC7_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC7_ROHC => new CRCConfig() - { - HashSizeInBits = 7, - Polynomial = 0x4f, - InitialValue = 0x7f, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x9b, - InitialValue = 0xff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_DARC => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x39, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_DVBS2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_DVBS2 => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0xd5, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_EBU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_EBU => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x1d, - InitialValue = 0xff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ICODE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ICODE => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x1d, - InitialValue = 0xfd, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ITU standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ITU => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0x00, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x55, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_MAXIM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_MAXIM => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x31, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_ROHC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_ROHC => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x07, - InitialValue = 0xff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC8_WCDMA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC8_WCDMA => new CRCConfig() - { - HashSizeInBits = 8, - Polynomial = 0x9b, - InitialValue = 0x00, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC10 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC10 => new CRCConfig() - { - HashSizeInBits = 10, - Polynomial = 0x233, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC10_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC10_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 10, - Polynomial = 0x3d9, - InitialValue = 0x3ff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC11 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC11 => new CRCConfig() - { - HashSizeInBits = 11, - Polynomial = 0x385, - InitialValue = 0x01a, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_3GPP standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_3GPP => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0x80f, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = true, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0xf13, - InitialValue = 0xfff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC12_DECT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC12_DECT => new CRCConfig() - { - HashSizeInBits = 12, - Polynomial = 0x80f, - InitialValue = 0x000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC13_BBC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC13_BBC => new CRCConfig() - { - HashSizeInBits = 13, - Polynomial = 0x1cf5, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC14_DARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC14_DARC => new CRCConfig() - { - HashSizeInBits = 14, - Polynomial = 0x0805, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC15 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC15 => new CRCConfig() - { - HashSizeInBits = 15, - Polynomial = 0x4599, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC15_MPT1327 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC15_MPT1327 => new CRCConfig() - { - HashSizeInBits = 15, - Polynomial = 0x6815, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0001, - }.Clone(); - - /// - /// Creates an instance of configured to the ARC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig ARC => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_AUGCCITT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_AUGCCITT => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x1d0f, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_BUYPASS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_BUYPASS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_CCITTFALSE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_CCITTFALSE => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_CDMA2000 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_CDMA2000 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0xc867, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DDS110 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DDS110 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x800d, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DECTR standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DECTR => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x0589, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0001, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DECTX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DECTX => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x0589, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_DNP standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_DNP => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x3d65, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_EN13757 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_EN13757 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x3d65, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_GENIBUS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_GENIBUS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_MAXIM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_MAXIM => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_MCRF4XX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_MCRF4XX => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_RIELLO standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_RIELLO => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xb2aa, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_T10DIF standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_T10DIF => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8bb7, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_TELEDISK standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_TELEDISK => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0xa097, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_TMS37157 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_TMS37157 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x89ec, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC16_USB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC16_USB => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRCA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRCA => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xc6c6, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the KERMIT standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig KERMIT => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x0000, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the MODBUS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig MODBUS => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x8005, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the X25 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig X25 => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0xffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffff, - }.Clone(); - - /// - /// Creates an instance of configured to the XMODEM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig XMODEM => new CRCConfig() - { - HashSizeInBits = 16, - Polynomial = 0x1021, - InitialValue = 0x0000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24 => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x864cfb, - InitialValue = 0xb704ce, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24_FLEXRAYA standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24_FLEXRAYA => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x5d6dcb, - InitialValue = 0xfedcba, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC24_FLEXRAYB standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC24_FLEXRAYB => new CRCConfig() - { - HashSizeInBits = 24, - Polynomial = 0x5d6dcb, - InitialValue = 0xabcdef, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC31_PHILIPS standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC31_PHILIPS => new CRCConfig() - { - HashSizeInBits = 31, - Polynomial = 0x04c11db7, - InitialValue = 0x7fffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x7fffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_BZIP2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_BZIP2 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32C standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32C => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x1edc6f41, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32D standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32D => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0xa833982b, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_MPEG2 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_MPEG2 => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32_POSIX standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32_POSIX => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC32Q standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC32Q => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x814141ab, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the JAMCRC standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig JAMCRC => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x04c11db7, - InitialValue = 0xffffffff, - ReflectIn = true, - ReflectOut = true, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the XFER standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig XFER => new CRCConfig() - { - HashSizeInBits = 32, - Polynomial = 0x000000af, - InitialValue = 0x00000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x00000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC40_GSM standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC40_GSM => new CRCConfig() - { - HashSizeInBits = 40, - Polynomial = 0x0004820009, - InitialValue = 0x0000000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0xffffffffff, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64 standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64 => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = 0x0000000000000000, - ReflectIn = false, - ReflectOut = false, - XOrOut = 0x0000000000000000, - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64_WE standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64_WE => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = unchecked((long)0xffffffffffffffff), - ReflectIn = false, - ReflectOut = false, - XOrOut = unchecked((long)0xffffffffffffffff), - }.Clone(); - - /// - /// Creates an instance of configured to the CRC64_XZ standard. - /// - /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. - /// - /// - /// A new, configured instance of . - /// - public static ICRCConfig CRC64_XZ => new CRCConfig() - { - HashSizeInBits = 64, - Polynomial = 0x42f0e1eba9ea3693, - InitialValue = unchecked((long)0xffffffffffffffff), - ReflectIn = true, - ReflectOut = true, - XOrOut = unchecked((long)0xffffffffffffffff), - }.Clone(); - - #endregion - /// - /// Makes a deep clone of the current instance. + /// Makes a deep clone of current instance. /// /// A deep clone of the current instance. public ICRCConfig Clone() => From d5dd76872f629cbb1dd4775f991c9e55a08688a4 Mon Sep 17 00:00:00 2001 From: Xen Date: Thu, 11 Sep 2025 01:41:56 +0300 Subject: [PATCH 44/71] Add CRC Config Profiles Signed-off-by: Xen --- .../CRC/ConfigProfiles/CRCConfigProfileARC.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC10.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC10_CDMA2000.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC11.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC12_3GPP.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC12_CDMA2000.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC12_DECT.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC13_BBC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC14_DARC.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC15.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC15_MPT1327.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_AUGCCITT.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_BUYPASS.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_CCITTFALSE.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_CDMA2000.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_DDS110.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_DECTR.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_DECTX.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_DNP.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_EN13757.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_GENIBUS.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_MAXIM.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_MCRF4XX.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_RIELLO.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_T10DIF.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_TELEDISK.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_TMS37157.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC16_USB.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC24.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC24_FLEXRAYA.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC24_FLEXRAYB.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC31_PHILIPS.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC32.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC32C.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC32D.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC32Q.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC32_BZIP2.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC32_MPEG2.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC32_POSIX.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC3_ROHC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC40_GSM.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC4_ITU.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC5_EPC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC5_ITU.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC5_USB.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC64.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC64_WE.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC64_XZ.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC6_CDMA2000A.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC6_CDMA2000B.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC6_DARC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC6_ITU.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC7.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC7_ROHC.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRC8.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_CDMA2000.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_DARC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_DVBS2.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_EBU.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_ICODE.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_ITU.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_MAXIM.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_ROHC.cs | 53 +++++++++++++++++++ .../CRCConfigProfileCRC8_WCDMA.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileCRCA.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileJAMCRC.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileKERMIT.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileMODBUS.cs | 53 +++++++++++++++++++ .../CRC/ConfigProfiles/CRCConfigProfileX25.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileXFER.cs | 53 +++++++++++++++++++ .../ConfigProfiles/CRCConfigProfileXMODEM.cs | 53 +++++++++++++++++++ 71 files changed, 3763 insertions(+) create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs create mode 100644 HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs new file mode 100644 index 0000000..25e831d --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("ARC", "ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileARC : CRCConfig + { + /// + /// Creates an instance of configured to the ARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileARC() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs new file mode 100644 index 0000000..af65277 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC10", "CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC10 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC10 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC10() + { + HashSizeInBits = 10; + Polynomial = 0x233; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs new file mode 100644 index 0000000..7cc1c15 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC10_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC10/CDMA2000", "CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC10_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC10_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC10_CDMA2000() + { + HashSizeInBits = 10; + Polynomial = 0x3D9; + InitialValue = unchecked((long)0x3FF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs new file mode 100644 index 0000000..743e400 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC11.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC11", "CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC11 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC11 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC11() + { + HashSizeInBits = 11; + Polynomial = 0x385; + InitialValue = unchecked((long)0x1A); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs new file mode 100644 index 0000000..a44bdf3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_3GPP.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/3GPP", "CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_3GPP : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_3GPP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_3GPP() + { + HashSizeInBits = 12; + Polynomial = 0x80F; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs new file mode 100644 index 0000000..a9c8368 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/CDMA2000", "CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_CDMA2000() + { + HashSizeInBits = 12; + Polynomial = 0xF13; + InitialValue = unchecked((long)0xFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs new file mode 100644 index 0000000..c5322aa --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC12_DECT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC12/DECT", "CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC12_DECT : CRCConfig + { + /// + /// Creates an instance of configured to the CRC12_DECT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC12_DECT() + { + HashSizeInBits = 12; + Polynomial = 0x80F; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs new file mode 100644 index 0000000..0fbfe02 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC13_BBC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC13/BBC", "CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC13_BBC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC13_BBC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC13_BBC() + { + HashSizeInBits = 13; + Polynomial = 0x1CF5; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs new file mode 100644 index 0000000..321fc89 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC14_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC14/DARC", "CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC14_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC14_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC14_DARC() + { + HashSizeInBits = 14; + Polynomial = 0x805; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs new file mode 100644 index 0000000..9d52fee --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC15", "CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC15 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC15 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC15() + { + HashSizeInBits = 15; + Polynomial = 0x4599; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs new file mode 100644 index 0000000..3d7e0fb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC15_MPT1327.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC15/MPT1327", "CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC15_MPT1327 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC15_MPT1327 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC15_MPT1327() + { + HashSizeInBits = 15; + Polynomial = 0x6815; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x1); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs new file mode 100644 index 0000000..42daa9b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_AUGCCITT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/AUGCCITT", "CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_AUGCCITT : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_AUGCCITT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_AUGCCITT() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x1D0F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs new file mode 100644 index 0000000..29121e9 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_BUYPASS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/BUYPASS", "CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_BUYPASS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_BUYPASS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_BUYPASS() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs new file mode 100644 index 0000000..8b674f2 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CCITTFALSE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/CCITTFALSE", "CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_CCITTFALSE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_CCITTFALSE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_CCITTFALSE() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs new file mode 100644 index 0000000..ad9837a --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/CDMA2000", "CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_CDMA2000() + { + HashSizeInBits = 16; + Polynomial = 0xC867; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs new file mode 100644 index 0000000..0adab83 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DDS110.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DDS110", "CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DDS110 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DDS110 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DDS110() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x800D); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs new file mode 100644 index 0000000..c13fba3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTR.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DECTR", "CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DECTR : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DECTR standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DECTR() + { + HashSizeInBits = 16; + Polynomial = 0x589; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x1); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs new file mode 100644 index 0000000..b31a09b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DECTX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DECTX", "CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DECTX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DECTX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DECTX() + { + HashSizeInBits = 16; + Polynomial = 0x589; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs new file mode 100644 index 0000000..c37b320 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_DNP.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/DNP", "CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_DNP : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_DNP standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_DNP() + { + HashSizeInBits = 16; + Polynomial = 0x3D65; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs new file mode 100644 index 0000000..7a563d2 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_EN13757.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/EN13757", "CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_EN13757 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_EN13757 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_EN13757() + { + HashSizeInBits = 16; + Polynomial = 0x3D65; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs new file mode 100644 index 0000000..eaf491c --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_GENIBUS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/GENIBUS", "CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_GENIBUS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_GENIBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_GENIBUS() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs new file mode 100644 index 0000000..e2bd5cf --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MAXIM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/MAXIM", "CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_MAXIM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_MAXIM() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs new file mode 100644 index 0000000..01cf5fc --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_MCRF4XX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/MCRF4XX", "CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_MCRF4XX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_MCRF4XX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_MCRF4XX() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs new file mode 100644 index 0000000..11ba045 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_RIELLO.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/RIELLO", "CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_RIELLO : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_RIELLO standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_RIELLO() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xB2AA); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs new file mode 100644 index 0000000..57ff565 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_T10DIF.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/T10DIF", "CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_T10DIF : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_T10DIF standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_T10DIF() + { + HashSizeInBits = 16; + Polynomial = 0x8BB7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs new file mode 100644 index 0000000..b7a8965 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TELEDISK.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/TELEDISK", "CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_TELEDISK : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_TELEDISK standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_TELEDISK() + { + HashSizeInBits = 16; + Polynomial = 0xA097; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs new file mode 100644 index 0000000..1ceffbe --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_TMS37157.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/TMS37157", "CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_TMS37157 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_TMS37157 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_TMS37157() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x89EC); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs new file mode 100644 index 0000000..3864827 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC16_USB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC16/USB", "CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC16_USB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC16_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC16_USB() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs new file mode 100644 index 0000000..936ad50 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24", "CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24() + { + HashSizeInBits = 24; + Polynomial = 0x864CFB; + InitialValue = unchecked((long)0xB704CE); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs new file mode 100644 index 0000000..329266e --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24/FLEXRAYA", "CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24_FLEXRAYA : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24_FLEXRAYA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24_FLEXRAYA() + { + HashSizeInBits = 24; + Polynomial = 0x5D6DCB; + InitialValue = unchecked((long)0xFEDCBA); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs new file mode 100644 index 0000000..d295b82 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC24_FLEXRAYB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC24/FLEXRAYB", "CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC24_FLEXRAYB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC24_FLEXRAYB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC24_FLEXRAYB() + { + HashSizeInBits = 24; + Polynomial = 0x5D6DCB; + InitialValue = unchecked((long)0xABCDEF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs new file mode 100644 index 0000000..f47d549 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC31_PHILIPS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC31/PHILIPS", "CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC31_PHILIPS : CRCConfig + { + /// + /// Creates an instance of configured to the CRC31_PHILIPS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC31_PHILIPS() + { + HashSizeInBits = 31; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0x7FFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x7FFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs new file mode 100644 index 0000000..b6a4035 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32", "CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs new file mode 100644 index 0000000..e55eb39 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32C.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32C", "CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32C : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32C standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32C() + { + HashSizeInBits = 32; + Polynomial = 0x1EDC6F41; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs new file mode 100644 index 0000000..c42391f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32D.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32D", "CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32D : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32D standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32D() + { + HashSizeInBits = 32; + Polynomial = 0xA833982B; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs new file mode 100644 index 0000000..4bab4cb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32Q.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32Q", "CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32Q : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32Q standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32Q() + { + HashSizeInBits = 32; + Polynomial = 0x814141AB; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs new file mode 100644 index 0000000..55bb955 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_BZIP2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/BZIP2", "CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_BZIP2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_BZIP2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_BZIP2() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs new file mode 100644 index 0000000..69816ab --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_MPEG2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/MPEG2", "CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_MPEG2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_MPEG2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_MPEG2() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs new file mode 100644 index 0000000..095d914 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC32_POSIX.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC32/POSIX", "CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC32_POSIX : CRCConfig + { + /// + /// Creates an instance of configured to the CRC32_POSIX standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC32_POSIX() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs new file mode 100644 index 0000000..81b3ba9 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC3_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC3/ROHC", "CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC3_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC3_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC3_ROHC() + { + HashSizeInBits = 3; + Polynomial = 0x3; + InitialValue = unchecked((long)0x7); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs new file mode 100644 index 0000000..826d877 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC40_GSM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC40/GSM", "CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC40_GSM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC40_GSM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC40_GSM() + { + HashSizeInBits = 40; + Polynomial = 0x4820009; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs new file mode 100644 index 0000000..8137dd4 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC4_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC4/ITU", "CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC4_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC4_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC4_ITU() + { + HashSizeInBits = 4; + Polynomial = 0x3; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs new file mode 100644 index 0000000..9b152e0 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_EPC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/EPC", "CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_EPC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_EPC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_EPC() + { + HashSizeInBits = 5; + Polynomial = 0x9; + InitialValue = unchecked((long)0x9); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs new file mode 100644 index 0000000..5af3f0b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/ITU", "CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_ITU() + { + HashSizeInBits = 5; + Polynomial = 0x15; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs new file mode 100644 index 0000000..266febf --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC5_USB.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC5/USB", "CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC5_USB : CRCConfig + { + /// + /// Creates an instance of configured to the CRC5_USB standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC5_USB() + { + HashSizeInBits = 5; + Polynomial = 0x5; + InitialValue = unchecked((long)0x1F); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x1F); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs new file mode 100644 index 0000000..7776108 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64", "CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs new file mode 100644 index 0000000..1913d0a --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_WE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64/WE", "CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64_WE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64_WE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64_WE() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0xFFFFFFFFFFFFFFFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0xFFFFFFFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs new file mode 100644 index 0000000..fd94a01 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC64_XZ.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC64/XZ", "CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC64_XZ : CRCConfig + { + /// + /// Creates an instance of configured to the CRC64_XZ standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC64_XZ() + { + HashSizeInBits = 64; + Polynomial = 0x42F0E1EBA9EA3693; + InitialValue = unchecked((long)0xFFFFFFFFFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFFFFFFFFFFFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs new file mode 100644 index 0000000..8af4c06 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000A.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/CDMA2000A", "CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_CDMA2000A : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_CDMA2000A standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_CDMA2000A() + { + HashSizeInBits = 6; + Polynomial = 0x27; + InitialValue = unchecked((long)0x3F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs new file mode 100644 index 0000000..3bb6644 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_CDMA2000B.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/CDMA2000B", "CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_CDMA2000B : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_CDMA2000B standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_CDMA2000B() + { + HashSizeInBits = 6; + Polynomial = 0x7; + InitialValue = unchecked((long)0x3F); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs new file mode 100644 index 0000000..448a0ff --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/DARC", "CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_DARC() + { + HashSizeInBits = 6; + Polynomial = 0x19; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs new file mode 100644 index 0000000..a968cb6 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC6_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC6/ITU", "CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC6_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC6_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC6_ITU() + { + HashSizeInBits = 6; + Polynomial = 0x3; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs new file mode 100644 index 0000000..a9ccad6 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC7", "CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC7 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC7 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC7() + { + HashSizeInBits = 7; + Polynomial = 0x9; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs new file mode 100644 index 0000000..61708bc --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC7_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC7/ROHC", "CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC7_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC7_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC7_ROHC() + { + HashSizeInBits = 7; + Polynomial = 0x4F; + InitialValue = unchecked((long)0x7F); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs new file mode 100644 index 0000000..0606ad3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8", "CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs new file mode 100644 index 0000000..3638adb --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_CDMA2000.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/CDMA2000", "CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_CDMA2000 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_CDMA2000 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_CDMA2000() + { + HashSizeInBits = 8; + Polynomial = 0x9B; + InitialValue = unchecked((long)0xFF); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs new file mode 100644 index 0000000..01f4189 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DARC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/DARC", "CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_DARC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_DARC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_DARC() + { + HashSizeInBits = 8; + Polynomial = 0x39; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs new file mode 100644 index 0000000..a9a6906 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_DVBS2.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/DVBS2", "CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_DVBS2 : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_DVBS2 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_DVBS2() + { + HashSizeInBits = 8; + Polynomial = 0xD5; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs new file mode 100644 index 0000000..9cac15f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_EBU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/EBU", "CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_EBU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_EBU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_EBU() + { + HashSizeInBits = 8; + Polynomial = 0x1D; + InitialValue = unchecked((long)0xFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs new file mode 100644 index 0000000..a2ac456 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ICODE.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ICODE", "CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ICODE : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ICODE standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ICODE() + { + HashSizeInBits = 8; + Polynomial = 0x1D; + InitialValue = unchecked((long)0xFD); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs new file mode 100644 index 0000000..f2f42ee --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ITU.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ITU", "CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ITU : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ITU standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ITU() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x55); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs new file mode 100644 index 0000000..e4610ec --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_MAXIM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/MAXIM", "CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_MAXIM : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_MAXIM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_MAXIM() + { + HashSizeInBits = 8; + Polynomial = 0x31; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs new file mode 100644 index 0000000..f1285b3 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_ROHC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/ROHC", "CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_ROHC : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_ROHC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_ROHC() + { + HashSizeInBits = 8; + Polynomial = 0x7; + InitialValue = unchecked((long)0xFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs new file mode 100644 index 0000000..8fa0aa0 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRC8_WCDMA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRC8/WCDMA", "CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRC8_WCDMA : CRCConfig + { + /// + /// Creates an instance of configured to the CRC8_WCDMA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRC8_WCDMA() + { + HashSizeInBits = 8; + Polynomial = 0x9B; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs new file mode 100644 index 0000000..6bf64be --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileCRCA.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("CRCA", "CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileCRCA : CRCConfig + { + /// + /// Creates an instance of configured to the CRCA standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileCRCA() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xC6C6); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs new file mode 100644 index 0000000..ff3609f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileJAMCRC.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("JAMCRC", "JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileJAMCRC : CRCConfig + { + /// + /// Creates an instance of configured to the JAMCRC standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileJAMCRC() + { + HashSizeInBits = 32; + Polynomial = 0x4C11DB7; + InitialValue = unchecked((long)0xFFFFFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs new file mode 100644 index 0000000..86f4901 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileKERMIT.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("KERMIT", "KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileKERMIT : CRCConfig + { + /// + /// Creates an instance of configured to the KERMIT standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileKERMIT() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x0); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs new file mode 100644 index 0000000..942317f --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileMODBUS.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("MODBUS", "MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileMODBUS : CRCConfig + { + /// + /// Creates an instance of configured to the MODBUS standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileMODBUS() + { + HashSizeInBits = 16; + Polynomial = 0x8005; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs new file mode 100644 index 0000000..c8f740b --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileX25.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("X25", "X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileX25 : CRCConfig + { + /// + /// Creates an instance of configured to the X25 standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileX25() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0xFFFF); + ReflectIn = true; + ReflectOut = true; + XOrOut = unchecked((long)0xFFFF); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs new file mode 100644 index 0000000..b13f469 --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXFER.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("XFER", "XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileXFER : CRCConfig + { + /// + /// Creates an instance of configured to the XFER standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileXFER() + { + HashSizeInBits = 32; + Polynomial = 0xAF; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} diff --git a/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs new file mode 100644 index 0000000..4f45b7c --- /dev/null +++ b/HashifyNet/Algorithms/CRC/ConfigProfiles/CRCConfigProfileXMODEM.cs @@ -0,0 +1,53 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Core; + +namespace HashifyNet.Algorithms.CRC +{ + /// + /// XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + [DefineHashConfigProfile("XMODEM", "XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.")] + public sealed class CRCConfigProfileXMODEM : CRCConfig + { + /// + /// Creates an instance of configured to the XMODEM standard. Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/. + /// + public CRCConfigProfileXMODEM() + { + HashSizeInBits = 16; + Polynomial = 0x1021; + InitialValue = unchecked((long)0x0); + ReflectIn = false; + ReflectOut = false; + XOrOut = unchecked((long)0x0); + } + } +} From 31986ee18f2d7a24655b30f5e4fbd34566dd55cc Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:45:03 -0700 Subject: [PATCH 45/71] Update Pearson Tests to switch to Config Profiles Signed-off-by: Xen --- .../Algorithms/Pearson/Pearson_Implementation_Tests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs index 940b146..de7a6bb 100644 --- a/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Pearson/Pearson_Implementation_Tests.cs @@ -78,7 +78,7 @@ public void Pearson_Implementation_Constructor_Config_IsCloned() var pearsonConfigMock = new Mock(); { pearsonConfigMock.Setup(pc => pc.Clone()) - .Returns(() => new WikipediaPearsonConfig() + .Returns(() => new PearsonConfigProfileWikipedia() { HashSizeInBits = 8 }); @@ -288,7 +288,7 @@ public class IStreamableHashFunction_Tests_WikipediaPearson protected override IPearson CreateHashFunction(int hashSize) => new Pearson_Implementation( - new WikipediaPearsonConfig() + new PearsonConfigProfileWikipedia() { HashSizeInBits = hashSize }); @@ -306,7 +306,7 @@ public class IStreamableHashFunction_Tests_WikipediaPearson_DefaultConstructor protected override IPearson CreateHashFunction(int hashSize) => new Pearson_Implementation( - new WikipediaPearsonConfig()); + new PearsonConfigProfileWikipedia()); } } -} \ No newline at end of file +} From ee3e2bb65a96f761d77d8aa7ef71fbccda9ae8b4 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:45:41 -0700 Subject: [PATCH 46/71] Refactor WikipediaPearsonConfig_Tests for new class Signed-off-by: Xen --- .../Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs index 0ccae94..4c04812 100644 --- a/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Pearson/WikipediaPearsonConfig_Tests.cs @@ -36,7 +36,7 @@ public class WikipediaPearsonConfig_Tests [Fact] public void WikipediaPearsonConfig_Defaults_HaventChanged() { - var wikipediaPearsonConfig = new WikipediaPearsonConfig(); + var wikipediaPearsonConfig = new PearsonConfigProfileWikipedia(); Assert.Equal(_expectedTable, wikipediaPearsonConfig.Table); Assert.Equal(8, wikipediaPearsonConfig.HashSizeInBits); @@ -45,14 +45,14 @@ public void WikipediaPearsonConfig_Defaults_HaventChanged() [Fact] public void WikipediaPearsonConfig_Clone_Works() { - var wikipediaPearsonConfig = new WikipediaPearsonConfig() + var wikipediaPearsonConfig = new PearsonConfigProfileWikipedia() { HashSizeInBits = 16 }; var wikipediaPearsonConfigClone = wikipediaPearsonConfig.Clone(); - Assert.IsType(wikipediaPearsonConfigClone); + Assert.IsType(wikipediaPearsonConfigClone); Assert.Equal(wikipediaPearsonConfig.Table, wikipediaPearsonConfigClone.Table); Assert.Equal(wikipediaPearsonConfig.HashSizeInBits, wikipediaPearsonConfigClone.HashSizeInBits); @@ -78,4 +78,4 @@ public void WikipediaPearsonConfig_Clone_Works() 43, 119, 224, 71, 122, 142, 42, 160, 104, 48, 247, 103, 15, 11, 138, 239 // 16 }; } -} \ No newline at end of file +} From af42634298010ed63ae34f9912d6b64246abc531 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:49:43 -0700 Subject: [PATCH 47/71] Update FactoryTests to use new config profiles Signed-off-by: Xen --- HashifyNet.UnitTests/Core/FactoryTests.cs | 33 ++++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/HashifyNet.UnitTests/Core/FactoryTests.cs b/HashifyNet.UnitTests/Core/FactoryTests.cs index 82ff892..1b66aab 100644 --- a/HashifyNet.UnitTests/Core/FactoryTests.cs +++ b/HashifyNet.UnitTests/Core/FactoryTests.cs @@ -32,7 +32,6 @@ using HashifyNet.Algorithms.CRC; using HashifyNet.Algorithms.FNV; using HashifyNet.Algorithms.Pearson; -using HashifyNet.Core.HashAlgorithm; using HashifyNet.UnitTests.Utilities; namespace HashifyNet.UnitTests.Core @@ -42,7 +41,7 @@ public class FactoryTests [Fact] public void Factory_CreateInstance_ValidInputs_Works() { - var instance = HashFactory.Create(CRCConfig.CRC32); + var instance = HashFactory.Create(new CRCConfigProfileCRC32()); Assert.NotNull(instance); Assert.IsType(instance); } @@ -95,11 +94,11 @@ public void Factory_ComputeNonCryptographicHashes_Works() { IHashFunctionBase[] functions = HashFactory.CreateHashAlgorithms(HashFunctionType.Noncryptographic, new Dictionary() { - { typeof(ICRC), CRCConfig.CRC32 }, - { typeof(IPearson), new WikipediaPearsonConfig() }, - { typeof(IFNV1), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IFNV1a), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IBuzHash), new DefaultBuzHashConfig() }, + { typeof(ICRC), new CRCConfigProfileCRC32() }, + { typeof(IPearson), new PearsonConfigProfileWikipedia() }, + { typeof(IFNV1), new FNVConfigProfile32Bits() }, + { typeof(IFNV1a), new FNVConfigProfile32Bits() }, + { typeof(IBuzHash), new BuzHashConfigProfileDefault() }, }); Assert.NotNull(functions); @@ -119,7 +118,7 @@ public void Factory_ComputeCryptographicHashes_Works() { IHashFunctionBase[] functions = HashFactory.CreateHashAlgorithms(HashFunctionType.Cryptographic, new Dictionary() { - { typeof(IArgon2id), Argon2idConfig.OWASP_Standard } + { typeof(IArgon2id), new Argon2idConfigProfileOWASP() } }, HashFactory.GetUnavailableHashAlgorithms()); Assert.NotNull(functions); @@ -142,7 +141,7 @@ public void Factory_GetWithType_Works() Type type = typeof(ICRC); Assert.NotNull(type); - var instance = HashFactory.Create(type, CRCConfig.CRC32); + var instance = HashFactory.Create(type, new CRCConfigProfileCRC32()); Assert.NotNull(instance); Assert.IsType(instance); } @@ -150,15 +149,17 @@ public void Factory_GetWithType_Works() [Fact] public void Factory_CreateInstance_WithConfig_Works() { - ICRC crc = HashFactory.Create(CRCConfig.CRC7); + ICRC crc = HashFactory.Create(new CRCConfigProfileCRC7()); Assert.NotNull(crc); Assert.IsType(crc); - Assert.Equal(CRCConfig.CRC7.HashSizeInBits, crc.Config.HashSizeInBits); - Assert.Equal(CRCConfig.CRC7.InitialValue, crc.Config.InitialValue); - Assert.Equal(CRCConfig.CRC7.Polynomial, crc.Config.Polynomial); - Assert.Equal(CRCConfig.CRC7.ReflectIn, crc.Config.ReflectIn); - Assert.Equal(CRCConfig.CRC7.ReflectOut, crc.Config.ReflectOut); - Assert.Equal(CRCConfig.CRC7.XOrOut, crc.Config.XOrOut); + + ICRCConfig crc7 = new CRCConfigProfileCRC7(); + Assert.Equal(crc7.HashSizeInBits, crc.Config.HashSizeInBits); + Assert.Equal(crc7.InitialValue, crc.Config.InitialValue); + Assert.Equal(crc7.Polynomial, crc.Config.Polynomial); + Assert.Equal(crc7.ReflectIn, crc.Config.ReflectIn); + Assert.Equal(crc7.ReflectOut, crc.Config.ReflectOut); + Assert.Equal(crc7.XOrOut, crc.Config.XOrOut); } [Fact] From dba09bbd757b46a085ca6679427612387d4acd1c Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:51:22 -0700 Subject: [PATCH 48/71] Update universal tests to use config profiles Signed-off-by: Xen --- HashifyNet.UnitTests/Core/UniversalTest.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/HashifyNet.UnitTests/Core/UniversalTest.cs b/HashifyNet.UnitTests/Core/UniversalTest.cs index cbce14d..dc01478 100644 --- a/HashifyNet.UnitTests/Core/UniversalTest.cs +++ b/HashifyNet.UnitTests/Core/UniversalTest.cs @@ -580,14 +580,14 @@ public void RunUniversalTest() IHashFunctionBase[] all = HashFactory.CreateHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic, new Dictionary() { // Non-cryptographic Forced Defaults - { typeof(ICRC), CRCConfig.CRC32 }, - { typeof(IPearson), new WikipediaPearsonConfig() }, - { typeof(IFNV1), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IFNV1a), FNVConfig.GetPredefinedConfig(32) }, - { typeof(IBuzHash), new DefaultBuzHashConfig() }, + { typeof(ICRC), new CRCConfigProfileCRC32() }, + { typeof(IPearson), new PearsonConfigProfileWikipedia() }, + { typeof(IFNV1), new FNVConfigProfile32Bits() }, + { typeof(IFNV1a), new FNVConfigProfile32Bits() }, + { typeof(IBuzHash), new BuzHashConfigProfileDefault() }, // Cryptographic Forced Defaults - { typeof(IArgon2id), Argon2idConfig.OWASP_Standard } + { typeof(IArgon2id), new Argon2idConfigProfileOWASP() } }, HashFactory.GetUnavailableHashAlgorithms()); Assert.NotNull(all); @@ -699,3 +699,4 @@ public void RunUniversalTest() } + From 41d086166fb3b68ae10bb3223ffa33a98ce3ef40 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:52:11 -0700 Subject: [PATCH 49/71] Update BuzHash tests to use config profiles Signed-off-by: Xen --- .../Algorithms/BuzHash/BuzHash_Implementation_Tests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs index b39b353..16e4c9e 100644 --- a/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/BuzHash/BuzHash_Implementation_Tests.cs @@ -82,7 +82,7 @@ public void BuzHash_Implementation_Constructor_Config_IsCloned() var buzHashConfigMock = new Mock(); { buzHashConfigMock.Setup(bhc => bhc.Clone()) - .Returns(new DefaultBuzHashConfig()); + .Returns(new BuzHashConfigProfileDefault()); } GC.KeepAlive( @@ -402,7 +402,7 @@ public class IStreamableHashFunction_Tests protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { HashSizeInBits = hashSize }); @@ -420,7 +420,7 @@ public class IStreamableHashFunction_Tests_DefaultConstructor protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig()); + new BuzHashConfigProfileDefault()); } public class IStreamableHashFunction_Tests_RightShift @@ -444,7 +444,7 @@ public class IStreamableHashFunction_Tests_RightShift protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { HashSizeInBits = hashSize, ShiftDirection = CircularShiftDirection.Right @@ -463,7 +463,7 @@ public class IStreamableHashFunction_Tests_RightShift_DefaultConstructor protected override IBuzHash CreateHashFunction(int hashSize) => new BuzHash_Implementation( - new DefaultBuzHashConfig() + new BuzHashConfigProfileDefault() { ShiftDirection = CircularShiftDirection.Right }); From 5a8ea12e29a276a4eee0ffbede173cef7a8a37a0 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:52:45 -0700 Subject: [PATCH 50/71] Update DefaultBuzHashConfig tests to use config profiles Signed-off-by: Xen --- .../Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs index 00bd85d..2145cbe 100644 --- a/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/BuzHash/DefaultBuzHashConfig_Tests.cs @@ -36,7 +36,7 @@ public class DefaultBuzHashConfig_Tests [Fact] public void DefaultBuzHashConfig_Defaults_HaventChanged() { - var defaultBuzHashConfig = new DefaultBuzHashConfig(); + var defaultBuzHashConfig = new BuzHashConfigProfileDefault(); Assert.Equal(_expectedRtab.Select(u => unchecked((long)u)).ToArray(), defaultBuzHashConfig.Rtab); Assert.Equal(64, defaultBuzHashConfig.HashSizeInBits); @@ -47,7 +47,7 @@ public void DefaultBuzHashConfig_Defaults_HaventChanged() [Fact] public void DefaultBuzHashConfig_Clone_Works() { - var defaultBuzHashConfig = new DefaultBuzHashConfig() + var defaultBuzHashConfig = new BuzHashConfigProfileDefault() { HashSizeInBits = 32, Seed = 1337L, @@ -56,7 +56,7 @@ public void DefaultBuzHashConfig_Clone_Works() var defaultBuzHashConfigClone = defaultBuzHashConfig.Clone(); - Assert.IsType(defaultBuzHashConfig); + Assert.IsType(defaultBuzHashConfig); Assert.Equal(defaultBuzHashConfig.Rtab, defaultBuzHashConfigClone.Rtab); Assert.Equal(defaultBuzHashConfig.HashSizeInBits, defaultBuzHashConfigClone.HashSizeInBits); From 7173a857d1c07ee5f8632a12051454d6d17b395b Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:54:54 -0700 Subject: [PATCH 51/71] Refactor FNV1Base_Tests Signed-off-by: Xen --- .../Algorithms/FNV/FNV1Base_Tests.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs index e3289fb..d08b4f5 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1Base_Tests.cs @@ -41,21 +41,20 @@ private FNV1Impl(IFNVConfig config) { } - public static UInt32[] _ExtendedMultiply(IReadOnlyList operand1, IReadOnlyList operand2, int hashSizeInBytes) => + public static uint[] ExtendedMultiplyTest(IReadOnlyList operand1, IReadOnlyList operand2, int hashSizeInBytes) => ExtendedMultiply(operand1, operand2, hashSizeInBytes); - } [Fact] public void FNV1Base_ExtendedMultiply_WorksConversly() { - var x = new UInt32[] { 65536, 1024 }; - var y = new UInt32[] { 524288, 65536, 1024, 8 }; + var x = new uint[] { 65536, 1024 }; + var y = new uint[] { 524288, 65536, 1024, 8 }; - var expectedValue = new UInt32[] { 0, 536870920, 134217729, 1572864 }; + var expectedValue = new uint[] { 0, 536870920, 134217729, 1572864 }; - Assert.Equal(expectedValue, FNV1Impl._ExtendedMultiply(x, y, 16)); - Assert.Equal(expectedValue, FNV1Impl._ExtendedMultiply(y, x, 16)); + Assert.Equal(expectedValue, FNV1Impl.ExtendedMultiplyTest(x, y, 16)); + Assert.Equal(expectedValue, FNV1Impl.ExtendedMultiplyTest(y, x, 16)); } } -} \ No newline at end of file +} From a3bb4d5ac3cbe98985beb5b657bb5370704fc9d8 Mon Sep 17 00:00:00 2001 From: Xen Date: Thu, 11 Sep 2025 01:57:16 +0300 Subject: [PATCH 52/71] Add Config Profile Helper for FNV Tests Signed-off-by: Xen --- .../FNV/Utilities/ConfigProfileHelper.cs | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs diff --git a/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs b/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs new file mode 100644 index 0000000..a0b3e43 --- /dev/null +++ b/HashifyNet.UnitTests/Algorithms/FNV/Utilities/ConfigProfileHelper.cs @@ -0,0 +1,57 @@ +// * +// ***************************************************************************** +// * +// * Copyright (c) 2025 Deskasoft International +// * +// * Permission is hereby granted, free of charge, to any person obtaining a copy +// * of this software and associated documentation files (the ""Software""), to deal +// * in the Software without restriction, including without limitation the rights +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// * copies of the Software, and to permit persons to whom the Software is +// * furnished to do so, subject to the following conditions: +// * +// * The above copyright notice and this permission notice shall be included in all +// * copies or substantial portions of the Software. +// * +// * THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// * SOFTWARE. +// * +// * +// * Please refer to LICENSE file. +// * +// ****************************************************************************** +// * + +using HashifyNet.Algorithms.FNV; + +namespace HashifyNet.UnitTests.Algorithms.FNV.Utilities +{ + internal static class ConfigProfileHelper + { + public static IFNVConfig GetProfile(int hashSizeInBits) + { + switch (hashSizeInBits) + { + case 32: + return new FNVConfigProfile32Bits(); + case 64: + return new FNVConfigProfile64Bits(); + case 128: + return new FNVConfigProfile128Bits(); + case 256: + return new FNVConfigProfile256Bits(); + case 512: + return new FNVConfigProfile512Bits(); + case 1024: + return new FNVConfigProfile1024Bits(); + default: + throw new ArgumentOutOfRangeException(nameof(hashSizeInBits), "Only 32, 64, 128, 256, 512, and 1024 are valid hash sizes for FNV."); + } + } + } +} From f6e539cb55482f940dd8dde9aaf3cf50c9daa093 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:58:09 -0700 Subject: [PATCH 53/71] Use ConfigProfileHelper for FNV tests Signed-off-by: Xen --- HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs index 3ac56f2..7c8ae11 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNVConfig_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using System.Numerics; namespace HashifyNet.UnitTests.Algorithms.FNV @@ -74,7 +75,7 @@ public void FNVConfig_GetPredefinedConfig_InvalidSizes_Throw() Assert.Equal( "hashSizeInBits", Assert.Throws( - () => FNVConfig.GetPredefinedConfig(invalidHashSize)) + () => ConfigProfileHelper.GetProfile(invalidHashSize)) .ParamName); } } @@ -84,7 +85,7 @@ public void FNVConfig_GetPredefinedConfig_ExpectedValues_Work() { foreach (var expectedPredefinedConfig in _expectedPredefinedConfigs) { - var fnvConfig = FNVConfig.GetPredefinedConfig(expectedPredefinedConfig.HashSizeInBits); + var fnvConfig = ConfigProfileHelper.GetProfile(expectedPredefinedConfig.HashSizeInBits); Assert.Equal(expectedPredefinedConfig.HashSizeInBits, fnvConfig.HashSizeInBits); Assert.Equal(expectedPredefinedConfig.Prime, fnvConfig.Prime); @@ -127,4 +128,4 @@ public void FNVConfig_GetPredefinedConfig_ExpectedValues_Work() } }; } -} \ No newline at end of file +} From 3d0a2d4d66579a435ce4e12345838e55f4a99a8c Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:58:47 -0700 Subject: [PATCH 54/71] Use ConfigProfileHelper for FNV Tests Signed-off-by: Xen --- .../Algorithms/FNV/FNV1_Implementation_Tests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs index 80cecda..2d0e2a3 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1_Implementation_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using HashifyNet.UnitTests.Utilities; using Moq; using System.Numerics; @@ -350,7 +351,7 @@ public class IStreamableHashFunction_Tests protected override IFNV1 CreateHashFunction(int hashSize) => new FNV1_Implementation( - FNVConfig.GetPredefinedConfig(hashSize)); + ConfigProfileHelper.GetProfile(hashSize)); } } -} \ No newline at end of file +} From 8c91b79b5d6fd28dd19644ad14d924a1d049a1e3 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 15:59:14 -0700 Subject: [PATCH 55/71] Use ConfigProfileHelper for FNV Tests Signed-off-by: Xen --- .../Algorithms/FNV/FNV1a_Implementation_Tests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs index 985735b..9d031f1 100644 --- a/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/FNV/FNV1a_Implementation_Tests.cs @@ -28,6 +28,7 @@ // * using HashifyNet.Algorithms.FNV; +using HashifyNet.UnitTests.Algorithms.FNV.Utilities; using HashifyNet.UnitTests.Utilities; using Moq; using System.Numerics; @@ -351,7 +352,7 @@ public class IStreamableHashFunction_Tests protected override IFNV1a CreateHashFunction(int hashSize) => new FNV1a_Implementation( - FNVConfig.GetPredefinedConfig(hashSize)); + ConfigProfileHelper.GetProfile(hashSize)); } } -} \ No newline at end of file +} From 489b8187257f4162559389add5b83a7632c16ae9 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:22:00 -0700 Subject: [PATCH 56/71] Update CRC tests to use config profiles Signed-off-by: Xen --- .../Algorithms/CRC/CRCConfig_Tests.cs | 144 +++++++++--------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs b/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs index 23237c5..975bf54 100644 --- a/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/CRC/CRCConfig_Tests.cs @@ -67,7 +67,7 @@ public void CRCConfig_Standards_HaventChanged() [Fact] public void CRCConfig_Clone_Works() { - var crcConfig = CRCConfig.CRC64; + var crcConfig = new CRCConfigProfileCRC64(); var crcConfigClone = crcConfig.Clone(); @@ -84,7 +84,7 @@ public void CRCConfig_Clone_Works() private readonly IEnumerable, ICRCConfig>> _expectedCrcStandards = new[] { new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC3_ROHC, + () => new CRCConfigProfileCRC3_ROHC(), new CRCConfig { HashSizeInBits = 3, Polynomial = 0x3, @@ -95,7 +95,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC4_ITU, + () => new CRCConfigProfileCRC4_ITU(), new CRCConfig { HashSizeInBits = 4, Polynomial = 0x3, @@ -106,7 +106,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_EPC, + () => new CRCConfigProfileCRC5_EPC(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x09, @@ -117,7 +117,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_ITU, + () => new CRCConfigProfileCRC5_ITU(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x15, @@ -128,7 +128,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC5_USB, + () => new CRCConfigProfileCRC5_USB(), new CRCConfig { HashSizeInBits = 5, Polynomial = 0x05, @@ -139,7 +139,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_CDMA2000A, + () => new CRCConfigProfileCRC6_CDMA2000A(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x27, @@ -150,7 +150,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_CDMA2000B, + () => new CRCConfigProfileCRC6_CDMA2000B(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x07, @@ -161,7 +161,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_DARC, + () => new CRCConfigProfileCRC6_DARC(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x19, @@ -172,7 +172,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC6_ITU, + () => new CRCConfigProfileCRC6_ITU(), new CRCConfig { HashSizeInBits = 6, Polynomial = 0x03, @@ -183,7 +183,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC7, + () => new CRCConfigProfileCRC7(), new CRCConfig { HashSizeInBits = 7, Polynomial = 0x09, @@ -194,7 +194,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC7_ROHC, + () => new CRCConfigProfileCRC7_ROHC(), new CRCConfig { HashSizeInBits = 7, Polynomial = 0x4f, @@ -205,7 +205,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8, + () => new CRCConfigProfileCRC8(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -216,7 +216,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_CDMA2000, + () => new CRCConfigProfileCRC8_CDMA2000(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x9b, @@ -227,7 +227,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_DARC, + () => new CRCConfigProfileCRC8_DARC(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x39, @@ -238,7 +238,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_DVBS2, + () => new CRCConfigProfileCRC8_DVBS2(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0xd5, @@ -249,7 +249,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_EBU, + () => new CRCConfigProfileCRC8_EBU(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x1d, @@ -260,7 +260,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ICODE, + () => new CRCConfigProfileCRC8_ICODE(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x1d, @@ -271,7 +271,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ITU, + () => new CRCConfigProfileCRC8_ITU(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -282,7 +282,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_MAXIM, + () => new CRCConfigProfileCRC8_MAXIM(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x31, @@ -293,7 +293,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_ROHC, + () => new CRCConfigProfileCRC8_ROHC(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x07, @@ -304,7 +304,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC8_WCDMA, + () => new CRCConfigProfileCRC8_WCDMA(), new CRCConfig { HashSizeInBits = 8, Polynomial = 0x9b, @@ -315,7 +315,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC10, + () => new CRCConfigProfileCRC10(), new CRCConfig { HashSizeInBits = 10, Polynomial = 0x233, @@ -326,7 +326,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC10_CDMA2000, + () => new CRCConfigProfileCRC10_CDMA2000(), new CRCConfig { HashSizeInBits = 10, Polynomial = 0x3d9, @@ -337,7 +337,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC11, + () => new CRCConfigProfileCRC11(), new CRCConfig { HashSizeInBits = 11, Polynomial = 0x385, @@ -348,7 +348,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_3GPP, + () => new CRCConfigProfileCRC12_3GPP(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0x80f, @@ -359,7 +359,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_CDMA2000, + () => new CRCConfigProfileCRC12_CDMA2000(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0xf13, @@ -370,7 +370,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC12_DECT, + () => new CRCConfigProfileCRC12_DECT(), new CRCConfig { HashSizeInBits = 12, Polynomial = 0x80f, @@ -381,7 +381,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC13_BBC, + () => new CRCConfigProfileCRC13_BBC(), new CRCConfig { HashSizeInBits = 13, Polynomial = 0x1cf5, @@ -392,7 +392,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC14_DARC, + () => new CRCConfigProfileCRC14_DARC(), new CRCConfig { HashSizeInBits = 14, Polynomial = 0x0805, @@ -403,7 +403,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC15, + () => new CRCConfigProfileCRC15(), new CRCConfig { HashSizeInBits = 15, Polynomial = 0x4599, @@ -414,7 +414,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC15_MPT1327, + () => new CRCConfigProfileCRC15_MPT1327(), new CRCConfig { HashSizeInBits = 15, Polynomial = 0x6815, @@ -425,7 +425,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.ARC, + () => new CRCConfigProfileARC(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -436,7 +436,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_AUGCCITT, + () => new CRCConfigProfileCRC16_AUGCCITT(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -447,7 +447,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_BUYPASS, + () => new CRCConfigProfileCRC16_BUYPASS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -458,7 +458,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_CCITTFALSE, + () => new CRCConfigProfileCRC16_CCITTFALSE(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -469,7 +469,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_CDMA2000, + () => new CRCConfigProfileCRC16_CDMA2000(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0xc867, @@ -480,7 +480,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DDS110, + () => new CRCConfigProfileCRC16_DDS110(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -491,7 +491,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DECTR, + () => new CRCConfigProfileCRC16_DECTR(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x0589, @@ -502,7 +502,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DECTX, + () => new CRCConfigProfileCRC16_DECTX(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x0589, @@ -513,7 +513,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_DNP, + () => new CRCConfigProfileCRC16_DNP(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x3d65, @@ -524,7 +524,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_EN13757, + () => new CRCConfigProfileCRC16_EN13757(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x3d65, @@ -535,7 +535,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_GENIBUS, + () => new CRCConfigProfileCRC16_GENIBUS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -546,7 +546,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_MAXIM, + () => new CRCConfigProfileCRC16_MAXIM(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -557,7 +557,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_MCRF4XX, + () => new CRCConfigProfileCRC16_MCRF4XX(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -568,7 +568,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_RIELLO, + () => new CRCConfigProfileCRC16_RIELLO(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -579,7 +579,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_T10DIF, + () => new CRCConfigProfileCRC16_T10DIF(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8bb7, @@ -590,7 +590,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_TELEDISK, + () => new CRCConfigProfileCRC16_TELEDISK(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0xa097, @@ -601,7 +601,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_TMS37157, + () => new CRCConfigProfileCRC16_TMS37157(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -612,7 +612,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC16_USB, + () => new CRCConfigProfileCRC16_USB(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -623,7 +623,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRCA, + () => new CRCConfigProfileCRCA(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -634,7 +634,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.KERMIT, + () => new CRCConfigProfileKERMIT(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -645,7 +645,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.MODBUS, + () => new CRCConfigProfileMODBUS(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x8005, @@ -656,7 +656,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.X25, + () => new CRCConfigProfileX25(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -667,7 +667,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.XMODEM, + () => new CRCConfigProfileXMODEM(), new CRCConfig { HashSizeInBits = 16, Polynomial = 0x1021, @@ -678,7 +678,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24, + () => new CRCConfigProfileCRC24(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x864cfb, @@ -689,7 +689,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24_FLEXRAYA, + () => new CRCConfigProfileCRC24_FLEXRAYA(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x5d6dcb, @@ -700,7 +700,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC24_FLEXRAYB, + () => new CRCConfigProfileCRC24_FLEXRAYB(), new CRCConfig { HashSizeInBits = 24, Polynomial = 0x5d6dcb, @@ -711,7 +711,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC31_PHILIPS, + () => new CRCConfigProfileCRC31_PHILIPS(), new CRCConfig { HashSizeInBits = 31, Polynomial = 0x04c11db7, @@ -722,7 +722,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32, + () => new CRCConfigProfileCRC32(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -733,7 +733,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_BZIP2, + () => new CRCConfigProfileCRC32_BZIP2(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -744,7 +744,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32C, + () => new CRCConfigProfileCRC32C(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x1edc6f41, @@ -755,7 +755,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32D, + () => new CRCConfigProfileCRC32D(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0xa833982b, @@ -766,7 +766,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_MPEG2, + () => new CRCConfigProfileCRC32_MPEG2(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -777,7 +777,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32_POSIX, + () => new CRCConfigProfileCRC32_POSIX(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -788,7 +788,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC32Q, + () => new CRCConfigProfileCRC32Q(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x814141ab, @@ -799,7 +799,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.JAMCRC, + () => new CRCConfigProfileJAMCRC(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x04c11db7, @@ -810,7 +810,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.XFER, + () => new CRCConfigProfileXFER(), new CRCConfig { HashSizeInBits = 32, Polynomial = 0x000000af, @@ -821,7 +821,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC40_GSM, + () => new CRCConfigProfileCRC40_GSM(), new CRCConfig { HashSizeInBits = 40, Polynomial = 0x0004820009, @@ -832,7 +832,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64, + () => new CRCConfigProfileCRC64(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, @@ -843,7 +843,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64_WE, + () => new CRCConfigProfileCRC64_WE(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, @@ -854,7 +854,7 @@ public void CRCConfig_Clone_Works() } ), new KeyValuePair, ICRCConfig>( - () => CRCConfig.CRC64_XZ, + () => new CRCConfigProfileCRC64_XZ(), new CRCConfig { HashSizeInBits = 64, Polynomial = 0x42f0e1eba9ea3693, From 19f16de764276703179821712f61872a588c01f7 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:22:32 -0700 Subject: [PATCH 57/71] Update CRC tests to use config profiles Signed-off-by: Xen --- .../CRC/CRC_Implementation_Tests.cs | 144 +++++++++--------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs index eb32a45..68a532e 100644 --- a/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/CRC/CRC_Implementation_Tests.cs @@ -197,7 +197,7 @@ public class IStreamableHashFunction_Tests_CRC3_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC3_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC3_ROHC()); } public class IStreamableHashFunction_Tests_CRC4_ITU @@ -209,7 +209,7 @@ public class IStreamableHashFunction_Tests_CRC4_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC4_ITU); + new CRC_Implementation(new CRCConfigProfileCRC4_ITU()); } public class IStreamableHashFunction_Tests_CRC5_EPC @@ -221,7 +221,7 @@ public class IStreamableHashFunction_Tests_CRC5_EPC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_EPC); + new CRC_Implementation(new CRCConfigProfileCRC5_EPC()); } public class IStreamableHashFunction_Tests_CRC5_ITU @@ -233,7 +233,7 @@ public class IStreamableHashFunction_Tests_CRC5_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_ITU); + new CRC_Implementation(new CRCConfigProfileCRC5_ITU()); } public class IStreamableHashFunction_Tests_CRC5_USB @@ -245,7 +245,7 @@ public class IStreamableHashFunction_Tests_CRC5_USB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC5_USB); + new CRC_Implementation(new CRCConfigProfileCRC5_USB()); } public class IStreamableHashFunction_Tests_CRC6_CDMA2000A @@ -257,7 +257,7 @@ public class IStreamableHashFunction_Tests_CRC6_CDMA2000A }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_CDMA2000A); + new CRC_Implementation(new CRCConfigProfileCRC6_CDMA2000A()); } public class IStreamableHashFunction_Tests_CRC6_CDMA2000B @@ -269,7 +269,7 @@ public class IStreamableHashFunction_Tests_CRC6_CDMA2000B }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_CDMA2000B); + new CRC_Implementation(new CRCConfigProfileCRC6_CDMA2000B()); } public class IStreamableHashFunction_Tests_CRC6_DARC @@ -281,7 +281,7 @@ public class IStreamableHashFunction_Tests_CRC6_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_DARC); + new CRC_Implementation(new CRCConfigProfileCRC6_DARC()); } public class IStreamableHashFunction_Tests_CRC6_ITU @@ -293,7 +293,7 @@ public class IStreamableHashFunction_Tests_CRC6_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC6_ITU); + new CRC_Implementation(new CRCConfigProfileCRC6_ITU()); } public class IStreamableHashFunction_Tests_CRC7 @@ -305,7 +305,7 @@ public class IStreamableHashFunction_Tests_CRC7 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC7); + new CRC_Implementation(new CRCConfigProfileCRC7()); } public class IStreamableHashFunction_Tests_CRC7_ROHC @@ -317,7 +317,7 @@ public class IStreamableHashFunction_Tests_CRC7_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC7_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC7_ROHC()); } public class IStreamableHashFunction_Tests_CRC8 @@ -329,7 +329,7 @@ public class IStreamableHashFunction_Tests_CRC8 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8); + new CRC_Implementation(new CRCConfigProfileCRC8()); } public class IStreamableHashFunction_Tests_CRC8_CDMA2000 @@ -341,7 +341,7 @@ public class IStreamableHashFunction_Tests_CRC8_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC8_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC8_DARC @@ -353,7 +353,7 @@ public class IStreamableHashFunction_Tests_CRC8_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_DARC); + new CRC_Implementation(new CRCConfigProfileCRC8_DARC()); } public class IStreamableHashFunction_Tests_CRC8_DVBS2 @@ -365,7 +365,7 @@ public class IStreamableHashFunction_Tests_CRC8_DVBS2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_DVBS2); + new CRC_Implementation(new CRCConfigProfileCRC8_DVBS2()); } public class IStreamableHashFunction_Tests_CRC8_EBU @@ -377,7 +377,7 @@ public class IStreamableHashFunction_Tests_CRC8_EBU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_EBU); + new CRC_Implementation(new CRCConfigProfileCRC8_EBU()); } public class IStreamableHashFunction_Tests_CRC8_ICODE @@ -389,7 +389,7 @@ public class IStreamableHashFunction_Tests_CRC8_ICODE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ICODE); + new CRC_Implementation(new CRCConfigProfileCRC8_ICODE()); } public class IStreamableHashFunction_Tests_CRC8_ITU @@ -401,7 +401,7 @@ public class IStreamableHashFunction_Tests_CRC8_ITU }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ITU); + new CRC_Implementation(new CRCConfigProfileCRC8_ITU()); } public class IStreamableHashFunction_Tests_CRC8_MAXIM @@ -413,7 +413,7 @@ public class IStreamableHashFunction_Tests_CRC8_MAXIM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_MAXIM); + new CRC_Implementation(new CRCConfigProfileCRC8_MAXIM()); } public class IStreamableHashFunction_Tests_CRC8_ROHC @@ -425,7 +425,7 @@ public class IStreamableHashFunction_Tests_CRC8_ROHC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_ROHC); + new CRC_Implementation(new CRCConfigProfileCRC8_ROHC()); } public class IStreamableHashFunction_Tests_CRC8_WCDMA @@ -437,7 +437,7 @@ public class IStreamableHashFunction_Tests_CRC8_WCDMA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC8_WCDMA); + new CRC_Implementation(new CRCConfigProfileCRC8_WCDMA()); } public class IStreamableHashFunction_Tests_CRC10 @@ -449,7 +449,7 @@ public class IStreamableHashFunction_Tests_CRC10 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC10); + new CRC_Implementation(new CRCConfigProfileCRC10()); } public class IStreamableHashFunction_Tests_CRC10_CDMA2000 @@ -461,7 +461,7 @@ public class IStreamableHashFunction_Tests_CRC10_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC10_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC10_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC11 @@ -473,7 +473,7 @@ public class IStreamableHashFunction_Tests_CRC11 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC11); + new CRC_Implementation(new CRCConfigProfileCRC11()); } public class IStreamableHashFunction_Tests_CRC12_3GPP @@ -485,7 +485,7 @@ public class IStreamableHashFunction_Tests_CRC12_3GPP }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_3GPP); + new CRC_Implementation(new CRCConfigProfileCRC12_3GPP()); } public class IStreamableHashFunction_Tests_CRC12_CDMA2000 @@ -497,7 +497,7 @@ public class IStreamableHashFunction_Tests_CRC12_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC12_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC12_DECT @@ -509,7 +509,7 @@ public class IStreamableHashFunction_Tests_CRC12_DECT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC12_DECT); + new CRC_Implementation(new CRCConfigProfileCRC12_DECT()); } public class IStreamableHashFunction_Tests_CRC13_BBC @@ -521,7 +521,7 @@ public class IStreamableHashFunction_Tests_CRC13_BBC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC13_BBC); + new CRC_Implementation(new CRCConfigProfileCRC13_BBC()); } public class IStreamableHashFunction_Tests_CRC14_DARC @@ -533,7 +533,7 @@ public class IStreamableHashFunction_Tests_CRC14_DARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC14_DARC); + new CRC_Implementation(new CRCConfigProfileCRC14_DARC()); } public class IStreamableHashFunction_Tests_CRC15 @@ -545,7 +545,7 @@ public class IStreamableHashFunction_Tests_CRC15 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC15); + new CRC_Implementation(new CRCConfigProfileCRC15()); } public class IStreamableHashFunction_Tests_CRC15_MPT1327 @@ -557,7 +557,7 @@ public class IStreamableHashFunction_Tests_CRC15_MPT1327 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC15_MPT1327); + new CRC_Implementation(new CRCConfigProfileCRC15_MPT1327()); } public class IStreamableHashFunction_Tests_ARC @@ -569,7 +569,7 @@ public class IStreamableHashFunction_Tests_ARC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.ARC); + new CRC_Implementation(new CRCConfigProfileARC()); } public class IStreamableHashFunction_Tests_CRC16_AUGCCITT @@ -581,7 +581,7 @@ public class IStreamableHashFunction_Tests_CRC16_AUGCCITT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_AUGCCITT); + new CRC_Implementation(new CRCConfigProfileCRC16_AUGCCITT()); } public class IStreamableHashFunction_Tests_CRC16_BUYPASS @@ -593,7 +593,7 @@ public class IStreamableHashFunction_Tests_CRC16_BUYPASS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_BUYPASS); + new CRC_Implementation(new CRCConfigProfileCRC16_BUYPASS()); } public class IStreamableHashFunction_Tests_CRC16_CCITTFALSE @@ -605,7 +605,7 @@ public class IStreamableHashFunction_Tests_CRC16_CCITTFALSE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_CCITTFALSE); + new CRC_Implementation(new CRCConfigProfileCRC16_CCITTFALSE()); } public class IStreamableHashFunction_Tests_CRC16_CDMA2000 @@ -617,7 +617,7 @@ public class IStreamableHashFunction_Tests_CRC16_CDMA2000 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_CDMA2000); + new CRC_Implementation(new CRCConfigProfileCRC16_CDMA2000()); } public class IStreamableHashFunction_Tests_CRC16_DDS110 @@ -629,7 +629,7 @@ public class IStreamableHashFunction_Tests_CRC16_DDS110 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DDS110); + new CRC_Implementation(new CRCConfigProfileCRC16_DDS110()); } public class IStreamableHashFunction_Tests_CRC16_DECTR @@ -641,7 +641,7 @@ public class IStreamableHashFunction_Tests_CRC16_DECTR }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DECTR); + new CRC_Implementation(new CRCConfigProfileCRC16_DECTR()); } public class IStreamableHashFunction_Tests_CRC16_DECTX @@ -653,7 +653,7 @@ public class IStreamableHashFunction_Tests_CRC16_DECTX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DECTX); + new CRC_Implementation(new CRCConfigProfileCRC16_DECTX()); } public class IStreamableHashFunction_Tests_CRC16_DNP @@ -665,7 +665,7 @@ public class IStreamableHashFunction_Tests_CRC16_DNP }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_DNP); + new CRC_Implementation(new CRCConfigProfileCRC16_DNP()); } public class IStreamableHashFunction_Tests_CRC16_EN13757 @@ -677,7 +677,7 @@ public class IStreamableHashFunction_Tests_CRC16_EN13757 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_EN13757); + new CRC_Implementation(new CRCConfigProfileCRC16_EN13757()); } public class IStreamableHashFunction_Tests_CRC16_GENIBUS @@ -689,7 +689,7 @@ public class IStreamableHashFunction_Tests_CRC16_GENIBUS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_GENIBUS); + new CRC_Implementation(new CRCConfigProfileCRC16_GENIBUS()); } public class IStreamableHashFunction_Tests_CRC16_MAXIM @@ -701,7 +701,7 @@ public class IStreamableHashFunction_Tests_CRC16_MAXIM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_MAXIM); + new CRC_Implementation(new CRCConfigProfileCRC16_MAXIM()); } public class IStreamableHashFunction_Tests_CRC16_MCRF4XX @@ -713,7 +713,7 @@ public class IStreamableHashFunction_Tests_CRC16_MCRF4XX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_MCRF4XX); + new CRC_Implementation(new CRCConfigProfileCRC16_MCRF4XX()); } public class IStreamableHashFunction_Tests_CRC16_RIELLO @@ -725,7 +725,7 @@ public class IStreamableHashFunction_Tests_CRC16_RIELLO }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_RIELLO); + new CRC_Implementation(new CRCConfigProfileCRC16_RIELLO()); } public class IStreamableHashFunction_Tests_CRC16_T10DIF @@ -737,7 +737,7 @@ public class IStreamableHashFunction_Tests_CRC16_T10DIF }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_T10DIF); + new CRC_Implementation(new CRCConfigProfileCRC16_T10DIF()); } public class IStreamableHashFunction_Tests_CRC16_TELEDISK @@ -749,7 +749,7 @@ public class IStreamableHashFunction_Tests_CRC16_TELEDISK }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_TELEDISK); + new CRC_Implementation(new CRCConfigProfileCRC16_TELEDISK()); } public class IStreamableHashFunction_Tests_CRC16_TMS37157 @@ -761,7 +761,7 @@ public class IStreamableHashFunction_Tests_CRC16_TMS37157 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_TMS37157); + new CRC_Implementation(new CRCConfigProfileCRC16_TMS37157()); } public class IStreamableHashFunction_Tests_CRC16_USB @@ -773,7 +773,7 @@ public class IStreamableHashFunction_Tests_CRC16_USB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC16_USB); + new CRC_Implementation(new CRCConfigProfileCRC16_USB()); } public class IStreamableHashFunction_Tests_CRCA @@ -785,7 +785,7 @@ public class IStreamableHashFunction_Tests_CRCA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRCA); + new CRC_Implementation(new CRCConfigProfileCRCA()); } public class IStreamableHashFunction_Tests_KERMIT @@ -797,7 +797,7 @@ public class IStreamableHashFunction_Tests_KERMIT }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.KERMIT); + new CRC_Implementation(new CRCConfigProfileKERMIT()); } public class IStreamableHashFunction_Tests_MODBUS @@ -809,7 +809,7 @@ public class IStreamableHashFunction_Tests_MODBUS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.MODBUS); + new CRC_Implementation(new CRCConfigProfileMODBUS()); } public class IStreamableHashFunction_Tests_X25 @@ -821,7 +821,7 @@ public class IStreamableHashFunction_Tests_X25 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.X25); + new CRC_Implementation(new CRCConfigProfileX25()); } public class IStreamableHashFunction_Tests_XMODEM @@ -833,7 +833,7 @@ public class IStreamableHashFunction_Tests_XMODEM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.XMODEM); + new CRC_Implementation(new CRCConfigProfileXMODEM()); } public class IStreamableHashFunction_Tests_CRC24 @@ -845,7 +845,7 @@ public class IStreamableHashFunction_Tests_CRC24 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24); + new CRC_Implementation(new CRCConfigProfileCRC24()); } public class IStreamableHashFunction_Tests_CRC24_FLEXRAYA @@ -857,7 +857,7 @@ public class IStreamableHashFunction_Tests_CRC24_FLEXRAYA }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24_FLEXRAYA); + new CRC_Implementation(new CRCConfigProfileCRC24_FLEXRAYA()); } public class IStreamableHashFunction_Tests_CRC24_FLEXRAYB @@ -869,7 +869,7 @@ public class IStreamableHashFunction_Tests_CRC24_FLEXRAYB }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC24_FLEXRAYB); + new CRC_Implementation(new CRCConfigProfileCRC24_FLEXRAYB()); } public class IStreamableHashFunction_Tests_CRC31_PHILIPS @@ -881,7 +881,7 @@ public class IStreamableHashFunction_Tests_CRC31_PHILIPS }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC31_PHILIPS); + new CRC_Implementation(new CRCConfigProfileCRC31_PHILIPS()); } public class IStreamableHashFunction_Tests_CRC32 @@ -893,7 +893,7 @@ public class IStreamableHashFunction_Tests_CRC32 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32); + new CRC_Implementation(new CRCConfigProfileCRC32()); } public class IStreamableHashFunction_Tests_CRC32_BZIP2 @@ -905,7 +905,7 @@ public class IStreamableHashFunction_Tests_CRC32_BZIP2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_BZIP2); + new CRC_Implementation(new CRCConfigProfileCRC32_BZIP2()); } public class IStreamableHashFunction_Tests_CRC32C @@ -917,7 +917,7 @@ public class IStreamableHashFunction_Tests_CRC32C }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32C); + new CRC_Implementation(new CRCConfigProfileCRC32C()); } public class IStreamableHashFunction_Tests_CRC32D @@ -929,7 +929,7 @@ public class IStreamableHashFunction_Tests_CRC32D }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32D); + new CRC_Implementation(new CRCConfigProfileCRC32D()); } public class IStreamableHashFunction_Tests_CRC32_MPEG2 @@ -941,7 +941,7 @@ public class IStreamableHashFunction_Tests_CRC32_MPEG2 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_MPEG2); + new CRC_Implementation(new CRCConfigProfileCRC32_MPEG2()); } public class IStreamableHashFunction_Tests_CRC32_POSIX @@ -953,7 +953,7 @@ public class IStreamableHashFunction_Tests_CRC32_POSIX }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32_POSIX); + new CRC_Implementation(new CRCConfigProfileCRC32_POSIX()); } public class IStreamableHashFunction_Tests_CRC32Q @@ -965,7 +965,7 @@ public class IStreamableHashFunction_Tests_CRC32Q }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC32Q); + new CRC_Implementation(new CRCConfigProfileCRC32Q()); } public class IStreamableHashFunction_Tests_JAMCRC @@ -977,7 +977,7 @@ public class IStreamableHashFunction_Tests_JAMCRC }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.JAMCRC); + new CRC_Implementation(new CRCConfigProfileJAMCRC()); } public class IStreamableHashFunction_Tests_XFER @@ -989,7 +989,7 @@ public class IStreamableHashFunction_Tests_XFER }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.XFER); + new CRC_Implementation(new CRCConfigProfileXFER()); } public class IStreamableHashFunction_Tests_CRC40_GSM @@ -1001,7 +1001,7 @@ public class IStreamableHashFunction_Tests_CRC40_GSM }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC40_GSM); + new CRC_Implementation(new CRCConfigProfileCRC40_GSM()); } public class IStreamableHashFunction_Tests_CRC64 @@ -1013,7 +1013,7 @@ public class IStreamableHashFunction_Tests_CRC64 }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64); + new CRC_Implementation(new CRCConfigProfileCRC64()); } public class IStreamableHashFunction_Tests_CRC64_WE @@ -1025,7 +1025,7 @@ public class IStreamableHashFunction_Tests_CRC64_WE }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64_WE); + new CRC_Implementation(new CRCConfigProfileCRC64_WE()); } public class IStreamableHashFunction_Tests_CRC64_XZ @@ -1037,7 +1037,7 @@ public class IStreamableHashFunction_Tests_CRC64_XZ }; protected override ICRC CreateHashFunction(int hashSize) => - new CRC_Implementation(CRCConfig.CRC64_XZ); + new CRC_Implementation(new CRCConfigProfileCRC64_XZ()); } } -} \ No newline at end of file +} From acf1cd8498cc1afeeb368ae4401c5db78204004e Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:25:30 -0700 Subject: [PATCH 58/71] Update Argon2id tests to use config profiles Signed-off-by: Xen --- .../Algorithms/Argon2id/Argon2id_Implementation_Tests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs b/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs index 09cdfec..26f9cc5 100644 --- a/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs +++ b/HashifyNet.UnitTests/Algorithms/Argon2id/Argon2id_Implementation_Tests.cs @@ -140,7 +140,7 @@ public void Argon2id_Implementation_HashSizeInBits_IsFromConfig() [Fact] public void Argon2id_Implementation_Verify_Works() { - Argon2id_Implementation impl = new Argon2id_Implementation(Argon2idConfig.OWASP_Standard); + Argon2id_Implementation impl = new Argon2id_Implementation(new Argon2idConfigProfileOWASP()); IHashValue hash1 = impl.ComputeHash(TestConstants.FooBar); Assert.NotNull(hash1); @@ -153,7 +153,7 @@ public void Argon2id_Implementation_Verify_Works() [Fact] public void Argon2id_Implementation_Verify_Irrelevant_Fails() { - Argon2id_Implementation impl = new Argon2id_Implementation(Argon2idConfig.OWASP_Standard); + Argon2id_Implementation impl = new Argon2id_Implementation(new Argon2idConfigProfileOWASP()); IHashValue hash1 = impl.ComputeHash(TestConstants.FooBar); Assert.NotNull(hash1); @@ -185,7 +185,7 @@ protected override IHashValue ComputeHash(IArgon2id hf, byte[] data) protected override IArgon2id CreateHashFunction(int hashSize) => new Argon2id_Implementation( - Argon2idConfig.OWASP_Standard); + new Argon2idConfigProfileOWASP()); } } } From 53aedce94231344ff049c6c48b2fc3f9671cb03a Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:30:40 -0700 Subject: [PATCH 59/71] Enhance error messages in DefineHashConfigProfileAttribute Updated error messages to include current values for better debugging. Signed-off-by: Xen --- .../Core/Attributes/DefineHashConfigProfileAttribute.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs index 279074d..3223aac 100644 --- a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -58,24 +58,24 @@ public DefineHashConfigProfileAttribute(string name, string description = null if (name.Length < MinNameLength) { - throw new ArgumentException($"The config profile name must be at least {MinNameLength} characters in length.", nameof(name)); + throw new ArgumentException($"The config profile name must be at least {MinNameLength} characters in length. Current: {name}", nameof(name)); } if (name.Length > MaxNameLength) { - throw new ArgumentException($"The config profile name must not exceed {MaxNameLength} characters in length.", nameof(name)); + throw new ArgumentException($"The config profile name must not exceed {MaxNameLength} characters in length. Current: {name}", nameof(name)); } if (description != null) { if (description.Length < MinDescriptionLength) { - throw new ArgumentException($"The config profile description must be at least {MinDescriptionLength} characters in length.", nameof(description)); + throw new ArgumentException($"The config profile description must be at least {MinDescriptionLength} characters in length. Current: {description}", nameof(description)); } if (description.Length > MaxDescriptionLength) { - throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length.", nameof(description)); + throw new ArgumentException($"The config profile description must not exceed {MaxDescriptionLength} characters in length. Current: {description}", nameof(description)); } } From 8e19c0b5f7d586fedec26951dccb1e0139e72a24 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:36:04 -0700 Subject: [PATCH 60/71] Modify minimum name length in DefineHashConfigProfileAttribute Updated minimum name length from 4 to 3 characters. Signed-off-by: Xen --- HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs index 3223aac..1fa29a8 100644 --- a/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs +++ b/HashifyNet/Core/Attributes/DefineHashConfigProfileAttribute.cs @@ -37,7 +37,7 @@ namespace HashifyNet.Core [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal sealed class DefineHashConfigProfileAttribute : Attribute { - private const int MinNameLength = 4; + private const int MinNameLength = 3; private const int MaxNameLength = 64; private const int MinDescriptionLength = 32; private const int MaxDescriptionLength = 2048; @@ -84,3 +84,4 @@ public DefineHashConfigProfileAttribute(string name, string description = null } } } + From 5250d5aae72d62395ef400d4b7f868d52125c7f1 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:48:05 -0700 Subject: [PATCH 61/71] Add GetConfigProfiles extension Signed-off-by: Xen --- .../Core/Factory/HashFactory.Extensions.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/HashifyNet/Core/Factory/HashFactory.Extensions.cs b/HashifyNet/Core/Factory/HashFactory.Extensions.cs index 21db3a9..ab3a3b5 100644 --- a/HashifyNet/Core/Factory/HashFactory.Extensions.cs +++ b/HashifyNet/Core/Factory/HashFactory.Extensions.cs @@ -157,6 +157,26 @@ public static Type[] GetUnavailableHashAlgorithms() } #endif + /// + /// Retrieves the configuration profiles associated with the specified hash algorithm interface type. + /// + /// The type of hash algorithm interface for which to retrieve the configuration profiles. Cannot be . + /// An array of objects associated with the specified type, or an empty array + /// if no configuration profiles are found for the specified type. + /// Thrown if is . + public static IHashConfigProfile[] GetConfigProfiles(Type type) + { + _ = type ?? throw new ArgumentNullException(nameof(type)); + if (!_configProfiles.ContainsKey(type)) + { + return Array.Empty(); + } + else + { + return (IHashConfigProfile[])_configProfiles[type]; + } + } + /// /// Retrieves an array of concrete configuration types associated with the specified hash function type. /// From 762fd2ef425003bd9ea912c6004cb20154b24c90 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 16:57:24 -0700 Subject: [PATCH 62/71] Enhance FactoryTests with config profile validations Added tests for retrieving and validating hash algorithm configurations and profiles. Signed-off-by: Xen --- HashifyNet.UnitTests/Core/FactoryTests.cs | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/HashifyNet.UnitTests/Core/FactoryTests.cs b/HashifyNet.UnitTests/Core/FactoryTests.cs index 1b66aab..b5e3522 100644 --- a/HashifyNet.UnitTests/Core/FactoryTests.cs +++ b/HashifyNet.UnitTests/Core/FactoryTests.cs @@ -193,5 +193,53 @@ public void Factory_TryCreateDefaultConcreteConfig_NeverThrows() { HashFactory.TryCreateDefaultConcreteConfig(typeof(ICRC), out _); } + + [Fact] + public void Factory_GetConfigProfiles_Works() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + + List allProfiles = new(); + foreach (var algorithm in algorithms) + { + allProfiles.AddRange(HashFactory.GetConfigProfiles(algorithm)); + } + + Assert.NotEmpty(allProfiles); + Assert.All(allProfiles, item => Assert.NotNull(item)); + Assert.All(allProfiles, item => Assert.False(string.IsNullOrWhiteSpace(item.Name))); + } + + [Fact] + public void Factory_GetConfigProfiles_Null_Throws() + { + Assert.Throws(() => + { + HashFactory.GetConfigProfiles(null); + }); + } + + [Fact] + public void Factory_GetConfigProfiles_NoProfiles_Works() + { + var profiles = HashFactory.GetConfigProfiles(typeof(string)); + Assert.NotNull(profiles); + Assert.Empty(profiles); + } + + [Fact] + public void Factory_GetConfigProfiles_HasUniqueNames() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + foreach (var algorithm in algorithms) + { + var profiles = HashFactory.GetConfigProfiles(algorithm); + var names = new HashSet(StringComparer.OrdinalIgnoreCase); + foreach (var profile in profiles) + { + Assert.True(names.Add(profile.Name), $"Duplicate profile name '{profile.Name}' found for algorithm '{algorithm.FullName}'."); + } + } + } } } From 238da34d4ce5d4b1f032e8021b7100100ba51d56 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 17:04:29 -0700 Subject: [PATCH 63/71] Update HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xen --- .../Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs index 86fd42a..7124061 100644 --- a/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs +++ b/HashifyNet/Algorithms/FNV/ConfigProfiles/FNVConfigProfile64Bits.cs @@ -37,7 +37,7 @@ namespace HashifyNet.Algorithms.FNV /// /// This class defines the parameters specific to the 64-bit FNV hash algorithm, including the hash /// size, prime, and offset values. It is a sealed class and cannot be inherited. - [DefineHashConfigProfile("64Bits", "epresents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm.")] + [DefineHashConfigProfile("64Bits", "Represents the configuration profile for the 64-bit variant of the FNV (Fowler–Noll–Vo) hash algorithm.")] public sealed class FNVConfigProfile64Bits : FNVConfig { /// From 054d8010c2b0224b0c1e2b3405d113f37e275b42 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 17:17:47 -0700 Subject: [PATCH 64/71] Change configType to configProfileType Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index ec434c0..35aa45c 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -150,7 +150,7 @@ static HashFactory() for (int i = 0; i < configProfileTypes.Count; ++i) { Type configProfileType = configProfileTypes[i]; - ConstructorInfo configProfileCtor = configType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); + ConstructorInfo configProfileCtor = configProfileType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, 0); if (configProfileCtor == null) { // This should not have happened, as ConfigProfilesAttribute already checks for this in its constructor. From 7849bce4090d40c12eb9832aae4538ad125074e8 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:00:57 -0700 Subject: [PATCH 65/71] Remove trailing whitespace Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index 35aa45c..d5486b4 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -63,7 +63,6 @@ private static HashFactory Singleton private static readonly Hashtable _implementations; private static readonly Hashtable _concreteConfigTypes; private static readonly Hashtable _configProfiles; - /// /// Initializes the static state of the class by discovering and registering available hash /// algorithm implementations. From 88e729d7a8dd4ac78d1d80ea1b06c4e864c48fc6 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:04:38 -0700 Subject: [PATCH 66/71] Remove extra space Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index d5486b4..c7203c6 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -96,7 +96,7 @@ static HashFactory() continue; } - HashAlgorithmImplementationAttribute implementationAttribute = type.GetCustomAttribute(false); + HashAlgorithmImplementationAttribute implementationAttribute = type.GetCustomAttribute(false); if (implementationAttribute == null) { continue; @@ -270,3 +270,4 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) } } + From 69a04cc34db9d7d286c6897374e3fa234f3f8307 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:05:19 -0700 Subject: [PATCH 67/71] Reorder fields Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index c7203c6..b513b7e 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -60,8 +60,8 @@ private static HashFactory Singleton } } - private static readonly Hashtable _implementations; private static readonly Hashtable _concreteConfigTypes; + private static readonly Hashtable _implementations; private static readonly Hashtable _configProfiles; /// /// Initializes the static state of the class by discovering and registering available hash From d85ee43b0380f61ad3fcbdde0d2dbd48fc80a08e Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:12:55 -0700 Subject: [PATCH 68/71] Add ProfileType property to IHashConfigProfile Updated IHashConfigProfile interface to include ProfileType property. Signed-off-by: Xen --- HashifyNet/Core/Config/IHashConfigProfile.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/HashifyNet/Core/Config/IHashConfigProfile.cs b/HashifyNet/Core/Config/IHashConfigProfile.cs index a40aeee..008f731 100644 --- a/HashifyNet/Core/Config/IHashConfigProfile.cs +++ b/HashifyNet/Core/Config/IHashConfigProfile.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -27,6 +27,8 @@ // ****************************************************************************** // * +using System; + namespace HashifyNet { /// @@ -34,6 +36,11 @@ namespace HashifyNet /// public interface IHashConfigProfile { + /// + /// Gets the type of the config profile's class. + /// + Type ProfileType { get; } + /// /// Gets the name of the underlying config profile. /// From 56753111f43411c7e8b57c5ff7d9617597a12795 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:13:17 -0700 Subject: [PATCH 69/71] Add ProfileType to HashConfigProfile class Added ProfileType property and updated constructor to include it. Enhanced validation for profileType parameter. Signed-off-by: Xen --- HashifyNet/Core/Config/HashConfigProfile.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/HashifyNet/Core/Config/HashConfigProfile.cs b/HashifyNet/Core/Config/HashConfigProfile.cs index b991d2b..e0b3ede 100644 --- a/HashifyNet/Core/Config/HashConfigProfile.cs +++ b/HashifyNet/Core/Config/HashConfigProfile.cs @@ -1,4 +1,4 @@ -// * +// * // ***************************************************************************** // * // * Copyright (c) 2025 Deskasoft International @@ -33,21 +33,34 @@ namespace HashifyNet { internal sealed class HashConfigProfile : IHashConfigProfile { + public Type ProfileType { get; } public string Name { get; } public string Description { get; } private Func _profileFactory; - public HashConfigProfile(string name, string description, Func profileFactory) + public HashConfigProfile(Type profileType, string name, string description, Func profileFactory) { + if (profileType == null) + { + throw new ArgumentNullException(nameof(profileType), "The profile type cannot be null."); + } + + if (!typeof(IHashConfigBase).IsAssignableFrom(profileType)) + { + throw new ArgumentException($"The profile type must implement {nameof(IHashConfigBase)} interface.", nameof(profileType)); + } + if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("The profile name must be a non-empty string.", nameof(name)); } + if (profileFactory == null) { throw new ArgumentNullException(nameof(profileFactory), "The profile factory function cannot be null."); } + ProfileType = profileType; Name = name; Description = description; _profileFactory = profileFactory; From 7135b9a25f6ed6ba49a97f35fd4704e7cf9966e0 Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:14:18 -0700 Subject: [PATCH 70/71] Pass configProfileType to HashConfigProfile class Signed-off-by: Xen --- HashifyNet/Core/Factory/HashFactory.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/HashifyNet/Core/Factory/HashFactory.cs b/HashifyNet/Core/Factory/HashFactory.cs index b513b7e..6484eda 100644 --- a/HashifyNet/Core/Factory/HashFactory.cs +++ b/HashifyNet/Core/Factory/HashFactory.cs @@ -166,7 +166,7 @@ static HashFactory() } Func configProfileFactory = ReflectionHelper.CreateInstance(configProfileCtor); - profiles[i] = new HashConfigProfile(configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); + profiles[i] = new HashConfigProfile(configProfileType, configProfileAttribute.Name, configProfileAttribute.Description, configProfileFactory); } _configProfiles.Add(t.Item2.ImplementedInterface, profiles); @@ -269,5 +269,3 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config) } } } - - From 6ecbcb19bc296462cb72f337167ba4656a7968df Mon Sep 17 00:00:00 2001 From: Xen Date: Wed, 10 Sep 2025 18:18:24 -0700 Subject: [PATCH 71/71] Add Factory_GetConfigProfiles_Create_Works test Signed-off-by: Xen --- HashifyNet.UnitTests/Core/FactoryTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/HashifyNet.UnitTests/Core/FactoryTests.cs b/HashifyNet.UnitTests/Core/FactoryTests.cs index b5e3522..441cd3f 100644 --- a/HashifyNet.UnitTests/Core/FactoryTests.cs +++ b/HashifyNet.UnitTests/Core/FactoryTests.cs @@ -241,5 +241,21 @@ public void Factory_GetConfigProfiles_HasUniqueNames() } } } + + [Fact] + public void Factory_GetConfigProfiles_Create_Works() + { + var algorithms = HashFactory.GetHashAlgorithms(HashFunctionType.Cryptographic | HashFunctionType.Noncryptographic); + foreach (var algorithm in algorithms) + { + var profiles = HashFactory.GetConfigProfiles(algorithm); + foreach (var profile in profiles) + { + IHashConfigBase config = profile.Create(); + Assert.NotNull(config); + Assert.IsType(profile.ProfileType, config); + } + } + } } }