@@ -52,7 +52,7 @@ public static class IHashFunction_Extensions
5252 /// <returns>
5353 /// Hash value of the data.
5454 /// </returns>
55- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , bool data ) where CName : IHashConfig < CName >
55+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , bool data )
5656 {
5757 return hashFunction . ComputeHash (
5858 new byte [ 1 ] { data ? ( byte ) 1 : ( byte ) 0 } ) ;
@@ -66,7 +66,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
6666 /// <returns>
6767 /// Hash value of the data.
6868 /// </returns>
69- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , byte data ) where CName : IHashConfig < CName >
69+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , byte data )
7070 {
7171 return hashFunction . ComputeHash (
7272 new [ ] { data } ) ;
@@ -80,7 +80,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
8080 /// <returns>
8181 /// Hash value of the data as byte array.
8282 /// </returns>
83- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , char data ) where CName : IHashConfig < CName >
83+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , char data )
8484 {
8585 return hashFunction . ComputeHash (
8686 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -94,7 +94,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
9494 /// <returns>
9595 /// Hash value of the data as byte array.
9696 /// </returns>
97- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , double data ) where CName : IHashConfig < CName >
97+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , double data )
9898 {
9999 return hashFunction . ComputeHash (
100100 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -108,7 +108,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
108108 /// <returns>
109109 /// Hash value of the data as byte array.
110110 /// </returns>
111- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , float data ) where CName : IHashConfig < CName >
111+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , float data )
112112 {
113113 return hashFunction . ComputeHash (
114114 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -122,7 +122,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
122122 /// <returns>
123123 /// Hash value of the data as byte array.
124124 /// </returns>
125- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , int data ) where CName : IHashConfig < CName >
125+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , int data )
126126 {
127127 return hashFunction . ComputeHash (
128128 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -136,7 +136,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
136136 /// <returns>
137137 /// Hash value of the data as byte array.
138138 /// </returns>
139- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , long data ) where CName : IHashConfig < CName >
139+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , long data )
140140 {
141141 return hashFunction . ComputeHash (
142142 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -151,7 +151,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
151151 /// Hash value of the data as byte array.
152152 /// </returns>
153153 [ CLSCompliant ( false ) ]
154- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , sbyte data ) where CName : IHashConfig < CName >
154+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , sbyte data )
155155 {
156156 return hashFunction . ComputeHash (
157157 new [ ] { ( byte ) data } ) ;
@@ -165,7 +165,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
165165 /// <returns>
166166 /// Hash value of the data as byte array.
167167 /// </returns>
168- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , short data ) where CName : IHashConfig < CName >
168+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , short data )
169169 {
170170 return hashFunction . ComputeHash (
171171 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -182,7 +182,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
182182 /// <remarks>
183183 /// UTF-8 encoding used to convert string to bytes.
184184 /// </remarks>
185- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , string data ) where CName : IHashConfig < CName >
185+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , string data )
186186 {
187187 return hashFunction . ComputeHash (
188188 Encoding . UTF8 . GetBytes ( data ) ) ;
@@ -197,7 +197,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
197197 /// Hash value of the data as byte array.
198198 /// </returns>
199199 [ CLSCompliant ( false ) ]
200- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , uint data ) where CName : IHashConfig < CName >
200+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , uint data )
201201 {
202202 return hashFunction . ComputeHash (
203203 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -212,7 +212,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
212212 /// Hash value of the data as byte array.
213213 /// </returns>
214214 [ CLSCompliant ( false ) ]
215- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , ulong data ) where CName : IHashConfig < CName >
215+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , ulong data )
216216 {
217217 return hashFunction . ComputeHash (
218218 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -227,7 +227,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
227227 /// Hash value of the data as byte array.
228228 /// </returns>
229229 [ CLSCompliant ( false ) ]
230- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , ushort data ) where CName : IHashConfig < CName >
230+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , ushort data )
231231 {
232232 return hashFunction . ComputeHash (
233233 Endianness . GetBytesLittleEndian ( data ) ) ;
@@ -246,7 +246,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
246246 /// <returns>
247247 /// Hash value of the data as byte array.
248248 /// </returns>
249- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , bool data , int desiredHashSize ) where CName : IHashConfig < CName >
249+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , bool data , int desiredHashSize )
250250 {
251251 return hashFunction . ComputeHash (
252252 new byte [ 1 ] { data ? ( byte ) 1 : ( byte ) 0 } ,
@@ -262,7 +262,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
262262 /// <returns>
263263 /// Hash value of the data as byte array.
264264 /// </returns>
265- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , byte data , int desiredHashSize ) where CName : IHashConfig < CName >
265+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , byte data , int desiredHashSize )
266266 {
267267 return hashFunction . ComputeHash (
268268 new [ ] { data } ,
@@ -278,7 +278,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
278278 /// <returns>
279279 /// Hash value of the data as byte array.
280280 /// </returns>
281- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , char data , int desiredHashSize ) where CName : IHashConfig < CName >
281+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , char data , int desiredHashSize )
282282 {
283283 return hashFunction . ComputeHash (
284284 Endianness . GetBytesLittleEndian ( data ) ,
@@ -294,7 +294,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
294294 /// <returns>
295295 /// Hash value of the data as byte array.
296296 /// </returns>
297- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , double data , int desiredHashSize ) where CName : IHashConfig < CName >
297+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , double data , int desiredHashSize )
298298 {
299299 return hashFunction . ComputeHash (
300300 Endianness . GetBytesLittleEndian ( data ) ,
@@ -310,7 +310,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
310310 /// <returns>
311311 /// Hash value of the data as byte array.
312312 /// </returns>
313- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , float data , int desiredHashSize ) where CName : IHashConfig < CName >
313+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , float data , int desiredHashSize )
314314 {
315315 return hashFunction . ComputeHash (
316316 Endianness . GetBytesLittleEndian ( data ) ,
@@ -326,7 +326,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
326326 /// <returns>
327327 /// Hash value of the data as byte array.
328328 /// </returns>
329- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , int data , int desiredHashSize ) where CName : IHashConfig < CName >
329+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , int data , int desiredHashSize )
330330 {
331331 return hashFunction . ComputeHash (
332332 Endianness . GetBytesLittleEndian ( data ) ,
@@ -342,7 +342,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
342342 /// <returns>
343343 /// Hash value of the data as byte array.
344344 /// </returns>
345- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , long data , int desiredHashSize ) where CName : IHashConfig < CName >
345+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , long data , int desiredHashSize )
346346 {
347347 return hashFunction . ComputeHash (
348348 Endianness . GetBytesLittleEndian ( data ) ,
@@ -359,7 +359,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
359359 /// Hash value of the data as byte array.
360360 /// </returns>
361361 [ CLSCompliant ( false ) ]
362- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , sbyte data , int desiredHashSize ) where CName : IHashConfig < CName >
362+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , sbyte data , int desiredHashSize )
363363 {
364364 return hashFunction . ComputeHash (
365365 new [ ] { ( byte ) data } ,
@@ -375,7 +375,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
375375 /// <returns>
376376 /// Hash value of the data as byte array.
377377 /// </returns>
378- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , short data , int desiredHashSize ) where CName : IHashConfig < CName >
378+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , short data , int desiredHashSize )
379379 {
380380 return hashFunction . ComputeHash (
381381 Endianness . GetBytesLittleEndian ( data ) ,
@@ -394,7 +394,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
394394 /// <remarks>
395395 /// UTF-8 encoding used to convert string to bytes.
396396 /// </remarks>
397- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , string data , int desiredHashSize ) where CName : IHashConfig < CName >
397+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , string data , int desiredHashSize )
398398 {
399399 return hashFunction . ComputeHash (
400400 Encoding . UTF8 . GetBytes ( data ) ,
@@ -411,7 +411,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
411411 /// Hash value of the data as byte array.
412412 /// </returns>
413413 [ CLSCompliant ( false ) ]
414- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , uint data , int desiredHashSize ) where CName : IHashConfig < CName >
414+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , uint data , int desiredHashSize )
415415 {
416416 return hashFunction . ComputeHash (
417417 Endianness . GetBytesLittleEndian ( data ) ,
@@ -428,7 +428,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
428428 /// Hash value of the data as byte array.
429429 /// </returns>
430430 [ CLSCompliant ( false ) ]
431- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , ulong data , int desiredHashSize ) where CName : IHashConfig < CName >
431+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , ulong data , int desiredHashSize )
432432 {
433433 return hashFunction . ComputeHash (
434434 Endianness . GetBytesLittleEndian ( data ) ,
@@ -445,7 +445,7 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
445445 /// Hash value of the data as byte array.
446446 /// </returns>
447447 [ CLSCompliant ( false ) ]
448- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , ushort data , int desiredHashSize ) where CName : IHashConfig < CName >
448+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , ushort data , int desiredHashSize )
449449 {
450450 return hashFunction . ComputeHash (
451451 Endianness . GetBytesLittleEndian ( data ) ,
@@ -461,18 +461,18 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
461461 /// <returns>
462462 /// Hash value of the data as byte array.
463463 /// </returns>
464- public static IHashValue ComputeHash < CName > ( this IHashFunction < CName > hashFunction , byte [ ] data , int desiredHashSize ) where CName : IHashConfig < CName >
464+ public static IHashValue ComputeHash ( this IHashFunctionBase hashFunction , byte [ ] data , int desiredHashSize )
465465 {
466466 var hash = new BigInteger ( ) ;
467467 var desiredHashBytes = ( desiredHashSize + 7 ) / 8 ;
468468
469469 var seededData = new byte [ data . Length + 4 ] ;
470470 Array . Copy ( data , 0 , seededData , 4 , data . Length ) ;
471471
472- IHashConfig < CName > config = hashFunction . Config ;
472+ IHashConfigBase config = hashFunction . Config ;
473473 if ( config == null )
474474 {
475- throw new ArgumentException ( $ "{ nameof ( hashFunction ) } does not have a valid { nameof ( IHashConfig < CName > ) } instance.", nameof ( hashFunction ) ) ;
475+ throw new ArgumentException ( $ "{ nameof ( hashFunction ) } does not have a valid { nameof ( IHashConfigBase ) } instance.", nameof ( hashFunction ) ) ;
476476 }
477477
478478 var hashesNeeded = ( desiredHashSize + ( config . HashSizeInBits - 1 ) ) / config . HashSizeInBits ;
@@ -487,7 +487,6 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
487487 {
488488 Array . Copy ( Endianness . GetBytesLittleEndian ( x ) , seededData , 4 ) ;
489489 currentData = seededData ;
490-
491490 }
492491 else
493492 {
@@ -509,7 +508,6 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
509508 hash |= elementHash << ( x * config . HashSizeInBits ) ;
510509 }
511510
512-
513511 // XOr-fold the extra bits
514512 if ( hashesNeeded * config . HashSizeInBits != desiredHashSize )
515513 {
@@ -518,7 +516,6 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
518516 hash = ( hash ^ ( hash >> desiredHashSize ) ) & mask ;
519517 }
520518
521-
522519 // Convert to array that contains desiredHashSize bits
523520 var hashBytes = hash . ToByteArray ( ) ;
524521
@@ -538,4 +535,4 @@ public static IHashValue ComputeHash<CName>(this IHashFunction<CName> hashFuncti
538535
539536 #endregion
540537 }
541- }
538+ }
0 commit comments