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

Public Member Functions

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

Constructor & Destructor Documentation

◆ Fnv1aHash()

SystemEx.Hash.Fnv1aHash.Fnv1aHash ( Endian endian)

Craate a new instance.

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

Member Function Documentation

◆ Compute()

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

Computes the FNV-1a hash of the given input.

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

Implements SystemEx.Hash.IHash.

48 {
49 uint hash = seed == 0 ? Offset32 : seed;
50
51 for ( int i = 0 ; i < input.Count ; i++ ) {
52 hash ^= input[i];
53 hash *= Prime32;
54 }
55
56 hash ^= (hash >> 16);
57 return new Hash32(hash);
58 }

◆ ComputeLong()

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

Computes the FNV-1a hash of the given input.

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

Implements SystemEx.Hash.IHash.

65 {
66 ulong hash = seed == 0 ? Offset64 : seed;
67
68 for ( int i = 0 ; i < input.Count ; i++ ) {
69 hash ^= input[i];
70 hash *= Prime64;
71 }
72
73 // Dein typischer Amber‑Mixer
74 hash ^= (hash >> 32);
75
76 return new Hash64(hash);
77 }

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