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

Public Member Functions

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

Constructor & Destructor Documentation

◆ FletcherHash()

SystemEx.Hash.FletcherHash.FletcherHash ( Endian endian)

Craate a new instance.

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

Member Function Documentation

◆ Compute()

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

Computes the Fletcher hash of the given input.

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

Implements SystemEx.Hash.IHash.

41 {
42 uint sum1 = 0xffff;
43 uint sum2 = 0xffff;
44
45 int index = 0;
46 int length = (int) input.Count;
47
48 while ( length > 0 ) {
49 int tlen = (length > 360 ? 360 : length);
50 length -= tlen;
51
52 for ( int i = 0 ; i < tlen ; i++ ) {
53 sum1 = (sum1 + input[index++]) % 0xffff;
54 sum2 = (sum2 + sum1) % 0xffff;
55 }
56 }
57
58 uint result = (sum2 << 16) | sum1;
59 return new Hash32(result);
60 }
long Count
Gets the number of valid elements currently stored in the vector.
Definition FixedVector.cs:71
Here is the caller graph for this function:

◆ ComputeLong()

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

Computes the Fletcher hash of the given input.

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

Implements SystemEx.Hash.IHash.

67 {
68 // 64‑Bit Wrapper, da du nur die 32‑Bit‑Variante brauchst
69 var h32 = Compute(input, (uint)seed );
70 return new Hash64(h32.Value);
71 }
Here is the call graph for this function:

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