V2/Cet/IO/Cet.IO/Hashing/HashCrcCCITT.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 crc = this._seed;
            for (int i = 0; i < count; i++)
            {
                int temp = ((crc >> 8) ^ buffer[offset + i]) | (crc << 8);
                temp ^= (byte)temp >> 4;
                temp ^= temp << 12;
                crc = (ushort)(temp ^ (byte)temp << 5);
            }
            return (int)crc;
        }
public override int Compute ( byte [ ] buffer , int offset , int count ) { ushort crc = this . _seed ; for ( int i = 0 ; i < count ; i ++ ) { int temp = ( ( crc >> 8 ) ^ buffer [ offset + i ] ) | ( crc << 8 ) ; temp ^= ( byte ) temp >> 4 ; temp ^= temp << 12 ; crc = ( ushort ) ( temp ^ ( byte ) temp << 5 ) ; } return ( int ) crc ; }
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