SystemEX  Lacking
Additional generic collection types missing in .net
SystemEx.Hash.WeinbergHash Class Referencesealed
Inheritance diagram for SystemEx.Hash.WeinbergHash:
Collaboration diagram for SystemEx.Hash.WeinbergHash:

Public Member Functions

 WeinbergHash (Endian endian)
 Craate a new instance.
Hash32 Compute (FixedVector< byte > input, uint seed)
 Computes the Weinberg hash of the given input.
Hash64 ComputeLong (FixedVector< byte > input, ulong seed)
 Computes the Weinberg hash of the given input.

Constructor & Destructor Documentation

◆ WeinbergHash()

SystemEx.Hash.WeinbergHash.WeinbergHash ( Endian endian)

Craate a new instance.

Parameters
endianThe suing endian for creating a hash
33 {
34 m_endian = endian;
35 }

Member Function Documentation

◆ Compute()

Hash32 SystemEx.Hash.WeinbergHash.Compute ( FixedVector< byte > input,
uint seed )

Computes the Weinberg hash of the given input.

Parameters
inputThe input data to hash.
seedThe seed value for the hash computation.
Returns
The computed Weinberg hash as a 32-bit value.

Implements SystemEx.Hash.IHash.

43 {
44 uint hash = seed;
45 uint g;
46
47 for ( int i = 0 ; i < input.Count ; i++ ) {
48 hash = (hash << 4) + input[i];
49 g = hash & 0xF0000000u;
50
51 if ( g != 0 )
52 hash ^= (g >> 24) ^ g;
53 }
54
55 hash ^= (hash >> 16);
56 return new Hash32(hash);
57 }

◆ ComputeLong()

Hash64 SystemEx.Hash.WeinbergHash.ComputeLong ( FixedVector< byte > input,
ulong seed )

Computes the Weinberg hash of the given input.

Parameters
inputThe input data to hash.
seedThe seed value for the hash computation.
Returns
The computed Weinberg hash as a 64-bit value.

Implements SystemEx.Hash.IHash.

64 {
65 ulong hash = seed;
66 ulong g;
67
68 for ( int i = 0 ; i < input.Count ; i++ ) {
69 hash = (hash << 4) + input[i];
70 g = hash & 0xF000000000000000ul;
71
72 if ( g != 0 )
73 hash ^= (g >> 56) ^ g;
74 }
75
76 hash ^= (hash >> 32);
77 return new Hash64(hash);
78 }

The documentation for this class was generated from the following file:
  • WeinbergHash.cs