1- // *
1+ // *
22// *****************************************************************************
33// *
44// * Copyright (c) 2025 Deskasoft International
@@ -60,6 +60,7 @@ private static HashFactory Singleton
6060 }
6161 }
6262
63+ private static readonly Hashtable _concreteConfigTypes ;
6364 private static readonly Hashtable _implementations ;
6465 /// <summary>
6566 /// Initializes the static state of the <see cref="HashFactory"/> class by discovering and registering available hash
@@ -77,6 +78,7 @@ private static HashFactory Singleton
7778 static HashFactory ( )
7879 {
7980 _implementations = new Hashtable ( ) ;
81+ _concreteConfigTypes = new Hashtable ( ) ;
8082
8183 Type [ ] types = ReflectionHelper . GetClasses ( typeof ( Core . HashAlgorithmImplementationAttribute ) , false ) ;
8284 if ( types == null || types . Length < 1 )
@@ -87,11 +89,11 @@ static HashFactory()
8789 List < Tuple < Type , Core . HashAlgorithmImplementationAttribute > > validTypes = new List < Tuple < Type , Core . HashAlgorithmImplementationAttribute > > ( ) ;
8890 foreach ( Type type in types )
8991 {
90- if ( type . GetCustomAttribute < ObsoleteAttribute > ( ) != null )
92+ if ( type . GetCustomAttribute < ObsoleteAttribute > ( ) != null )
9193 {
9294 continue ;
9395 }
94-
96+
9597 IEnumerable < Core . HashAlgorithmImplementationAttribute > attrs = type . GetCustomAttributes < Core . HashAlgorithmImplementationAttribute > ( false ) ;
9698 if ( attrs == null )
9799 {
@@ -131,6 +133,8 @@ static HashFactory()
131133
132134 Type configType = t . Item2 . ConcreteConfig ;
133135
136+ _concreteConfigTypes . Add ( t . Item2 . ImplementedInterface , configType ) ;
137+
134138 // If the concrete config has no parameterless constructor, we cannot create a default instance. In this case, the parameterless Create function will throw.
135139 Func < object [ ] , object > configFactory = null ;
136140 ConstructorInfo configCtor = configType . GetConstructor ( BindingFlags . Public | BindingFlags . Instance , 0 ) ;
@@ -227,4 +231,3 @@ public IHashFunctionBase CreateInstance(Type type, IHashConfigBase config)
227231 }
228232 }
229233}
230-
0 commit comments