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

Public Member Functions

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

Constructor & Destructor Documentation

◆ AdlerHash()

SystemEx.Hash.AdlerHash.AdlerHash ( Endian endian)

Craate a new instance.

Parameters
endianThe suing endian for creating a hash
39 {
40 m_endian = endian;
41 }

Member Function Documentation

◆ Compute()

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

Computes the Adler hash of the given input.

Parameters
inputThe input data to hash.
seedThe seed value for the hash computation.
Returns
The computed Adler hash as a Hash32 object.

Implements SystemEx.Hash.IHash.

48 {
49 uint a = 1;
50 uint b = 0;
51
52 for ( int i = 0 ; i < input.Count ; i++ ) {
53 a = (a + input[i] ) % Mod;
54 b = (b + a) % Mod;
55 }
56
57 var ui = (b << 16) | a;
58
59 return new Hash32(ui);
60 }

◆ ComputeLong()

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

Computes the Adler hash of the given input.

Parameters
inputThe input data to hash.
seedThe seed value for the hash computation.
Returns
The computed Adler hash as a Hash64 object.

Implements SystemEx.Hash.IHash.

67 {
68 ulong a = 1;
69 ulong b = 0;
70
71 for ( int i = 0 ; i < input.Count ; i++ ) {
72 a = (a + input[i]) % Mod64;
73 b = (b + a) % Mod64;
74 }
75
76 var ui = (b << 32) | a;
77
78 return new Hash64(ui);
79 }

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