public Crc16(Crc16Type type, Endianness endianness) { _polynomial = GetPolynomialByType(type); if (endianness == Endianness.Big) { _polynomial = FlipPolynomial(_polynomial); _endianness = endianness; } Reset(); }
public Crc16(Crc16Type type, Endianness endianness, ushort seed) { _polynomial = GetPolynomialByType(type); if (endianness == Endianness.Big) { _polynomial = FlipPolynomial(_polynomial); _endianness = endianness; } _seed = seed; Reset(); }
private ushort GetPolynomialByType(Crc16Type type) { switch (type) { case Crc16Type.ARINC: return(0xD405); case Crc16Type.CCITT: return(0x8404); case Crc16Type.CDMA2000: return(0xE613); case Crc16Type.Chakravarty: return(0xA8F4); case Crc16Type.DECT: return(0x91A0); case Crc16Type.DNP: return(0xA6BC); case Crc16Type.IBM: return(0xA001); case Crc16Type.OpenSafety_A: return(0xAC9A); case Crc16Type.OpenSafety_B: return(0xDAAE); case Crc16Type.Profibus: return(0xF3B8); case Crc16Type.T10: return(0xEDD1); default: throw new ArgumentOutOfRangeException("type", "The type parameter must be a valid Crc16Type."); } }
public Crc16(Crc16Type type) { _polynomial = GetPolynomialByType(type); Reset(); }