|
| | 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.
|
◆ FletcherHash()
| SystemEx.Hash.FletcherHash.FletcherHash |
( |
Endian | endian | ) |
|
Craate a new instance.
- Parameters
-
| endian | The suing endian for creating a hash |
32 {
33 m_endian = endian;
34 }
◆ Compute()
| Hash32 SystemEx.Hash.FletcherHash.Compute |
( |
FixedVector< byte > | input, |
|
|
uint | seed ) |
Computes the Fletcher hash of the given input.
- Parameters
-
| input | The input data to hash. |
| seed | The 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
◆ ComputeLong()
| Hash64 SystemEx.Hash.FletcherHash.ComputeLong |
( |
FixedVector< byte > | input, |
|
|
ulong | seed ) |
Computes the Fletcher hash of the given input.
- Parameters
-
| input | The input data to hash. |
| seed | The seed value for the hash computation. |
- Returns
- The computed Fletcher hash as a Hash64 object.
Implements SystemEx.Hash.IHash.
67 {
68
69 var h32 = Compute(input, (uint)seed );
70 return new Hash64(h32.Value);
71 }
The documentation for this class was generated from the following file: