V2/Cet/IO/Cet.IO/Hashing/HashCrc16.cs
/// <summary>
/// Calculate the hashing over a segment of a byte array
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="count"></param>
/// <returns></returns>
Calculate the hashing over a segment of a byte array
Calculate the hashing over a segment of a byte array
public override int Compute(
            byte[] buffer, 
            int offset, 
            int count)
        {
            ushort result = 0xFFFF;
            for (int i = 0; i < count; i++)
            {
                var temp = (byte)(buffer[offset + i] ^ result);
                result = (ushort)((result >> 8) ^ _table[temp]);
            }
            return result;
        }
public override int Compute ( byte [ ] buffer , int offset , int count ) { ushort result = 0xFFFF ; for ( int i = 0 ; i < count ; i ++ ) { var temp = ( byte ) ( buffer [ offset + i ] ^ result ) ; result = ( ushort ) ( ( result >> 8 ) ^ _table [ temp ] ) ; } return result ; }
Calculate the hashing over a segment of a byte array
Calculate the hashing over a segment of a byte array
None
buffer
byte[]
None
offset
int
None
count
int
None