public uint Finish() { if (!mFinished) { mFinished = true; mCRC = CRC.Finish(mCRC); } return(mCRC); }
protected override void Dispose(bool disposing) { try { if (disposing && !mClosed) { mClosed = true; mCurrentCRC = CRC.Finish(mCurrentCRC); #if DEBUG if (mCurrentCRC == mExpectedCRC) { System.Diagnostics.Debug.WriteLine("CRC ok: " + mExpectedCRC.ToString("x8")); } else { System.Diagnostics.Debugger.Break(); System.Diagnostics.Debug.WriteLine("bad CRC"); } double lengthInv = 1.0 / mLength; double entropy = 0; for (int i = 0; i < 256; i++) { if (mBytes[i] != 0) { double p = lengthInv * mBytes[i]; entropy -= p * Math.Log(p, 256); } } System.Diagnostics.Debug.WriteLine("entropy: " + (int)(entropy * 100) + "%"); #endif } } finally { base.Dispose(disposing); } }