/// <summary> /// Constructor for custom 32-bit CRC object - Don't use this unless you really know /// what the heck you are doing. /// </summary> /// <param name="KeyPoly">Custom key polynomial</param> /// <param name="InitialRegVal">Initial register value</param> /// <param name="FinalizeXorVal">Value that is xor'd with final CRC</param> /// <param name="Reflected">Indicates whether the algorithm expects reflected input bytes</param> /// <param name="BytesShiftedPerCycle">How many bytes are handled at a time (1 or 2). /// <param name="CrcType">Indicates whether CRC is incremental (incomplete) or oneshot (complete).</param> /// <param name="CrcCalcMethod">How many bytes are handled at a time (1 or 2). /// The internal table size is determined by this parameter, 1 is most common (leads to 1kbyte table).</param> public CRC32(UInt32 KeyPoly, UInt32 InitialRegVal, UInt32 FinalizeXorVal, Boolean Reflected, Int32 BytesShiftedPerCycle, CRCType CrcType, CRCCalcMethod CrcCalcMethod) { lut = null; poly = KeyPoly; initReg = InitialRegVal; currCRC = initReg; finalReg = FinalizeXorVal; reflected = Reflected; NumBytesPerRegShift = BytesShiftedPerCycle; this.CrcType = CrcType; this.CrcCalcMethod = CrcCalcMethod; // Build the look up table BuildTable(); // Call reset to set initial value for currCRC; ResetCRC(); }
/// <summary> /// Constructor for custom 32-bit CRC object - Don't use this unless you really know /// what the heck you are doing. /// </summary> /// <param name="KeyPoly">Custom key polynomial</param> /// <param name="InitialRegVal">Initial register value</param> /// <param name="FinalizeXorVal">Value that is xor'd with final CRC</param> /// <param name="Reflected">Indicates whether the algorithm expects reflected input bytes</param> /// <param name="BytesShiftedPerCycle">How many bytes are handled at a time (1 or 2). /// <param name="CrcType">Indicates whether CRC is incremental (incomplete) or oneshot (complete).</param> /// <param name="CrcCalcMethod">How many bytes are handled at a time (1 or 2). /// The internal table size is determined by this parameter, 1 is most common (leads to 1kbyte table).</param> public CRC32( UInt32 KeyPoly, UInt32 InitialRegVal, UInt32 FinalizeXorVal, Boolean Reflected, Int32 BytesShiftedPerCycle, CRCType CrcType, CRCCalcMethod CrcCalcMethod ) { lut = null; poly = KeyPoly; initReg = InitialRegVal; currCRC = initReg; finalReg = FinalizeXorVal; reflected = Reflected; NumBytesPerRegShift = BytesShiftedPerCycle; this.CrcType = CrcType; this.CrcCalcMethod = CrcCalcMethod; // Build the look up table BuildTable(); // Call reset to set initial value for currCRC; ResetCRC(); }