protected int[] ComputeHash(IChecksum checksum, byte[] data, int m, int k) { if (checksum == null) { throw new ArgumentNullException(nameof(checksum)); } int[] positions = new int[k]; int hashes = 0; int salt = 0; byte[] output = new byte[64]; const int seed32 = 89478583; while (hashes < k) { checksum.Reset(); checksum.Update(data); checksum.Update(hashes + salt++ + seed32); int hash = Rejection((int)checksum.Value, m); if (hash != -1) { positions[hashes++] = hash; } } return(positions); }
void InitBlock() { char magic1 = BsGetUChar(); char magic2 = BsGetUChar(); char magic3 = BsGetUChar(); char magic4 = BsGetUChar(); char magic5 = BsGetUChar(); char magic6 = BsGetUChar(); if (magic1 == 0x17 && magic2 == 0x72 && magic3 == 0x45 && magic4 == 0x38 && magic5 == 0x50 && magic6 == 0x90) { Complete(); return; } if (magic1 != 0x31 || magic2 != 0x41 || magic3 != 0x59 || magic4 != 0x26 || magic5 != 0x53 || magic6 != 0x59) { BadBlockHeader(); streamEnd = true; return; } storedBlockCRC = BsGetInt32(); blockRandomised = (BsR(1) == 1); GetAndMoveToFrontDecode(); mCrc.Reset(); currentState = START_BLOCK_STATE; }
private void InitBlock() { char c = BsGetUChar(); char c2 = BsGetUChar(); char c3 = BsGetUChar(); char c4 = BsGetUChar(); char c5 = BsGetUChar(); char c6 = BsGetUChar(); if (c == '\u0017' && c2 == 'r' && c3 == 'E' && c4 == '8' && c5 == 'P' && c6 == '\u0090') { Complete(); } else if (c != '1' || c2 != 'A' || c3 != 'Y' || c4 != '&' || c5 != 'S' || c6 != 'Y') { BadBlockHeader(); streamEnd = true; } else { storedBlockCRC = BsGetInt32(); blockRandomised = (BsR(1) == 1); GetAndMoveToFrontDecode(); mCrc.Reset(); currentState = 1; } }
private void InitBlock() { char ch = BsGetUChar(); _ch2 = BsGetUChar(); char ch3 = BsGetUChar(); char ch4 = BsGetUChar(); char ch5 = BsGetUChar(); char ch6 = BsGetUChar(); if ((((ch == '\x0017') && (_ch2 == 'r')) && ((ch3 == 'E') && (ch4 == '8'))) && ((ch5 == 'P') && (ch6 == '\x0090'))) { Complete(); } else if ((((ch != '1') || (_ch2 != 'A')) || ((ch3 != 'Y') || (ch4 != '&'))) || ((ch5 != 'S') || (ch6 != 'Y'))) { BadBlockHeader(); _streamEnd = true; } else { _storedBlockCrc = BsGetInt32(); _blockRandomised = BsR(1) == 1; GetAndMoveToFrontDecode(); _mCrc.Reset(); _currentState = 1; } }
private void InitBlock() { mCrc.Reset(); last = -1; for (int i = 0; i < 256; i++) { inUse[i] = false; } allowableBlockSize = 100000 * blockSize100k - 20; }
static void Check(IChecksum <ulong> crc, byte[] data, ulong value) { crc.Reset(); crc.Update(data); Assert.AreEqual(value, crc.Value, "Test crc {0} invalid result {1:x2} expected {2:x2}!", crc, crc.Value, value); }
public virtual void Reset() { upto = 0; @in.Reset(); }
void Check(IChecksum <uint> crc, byte[] data, uint value) { crc.Reset(); crc.Update(data); Assert.AreEqual(value, crc.Value); }
public void Reset() { Upto = 0; @in.Reset(); }