| 66 | } |
| 67 | |
| 68 | bool CBloomFilter::contains(Span<const unsigned char> vKey) const |
| 69 | { |
| 70 | if (vData.empty()) // Avoid divide-by-zero (CVE-2013-5700) |
| 71 | return true; |
| 72 | for (unsigned int i = 0; i < nHashFuncs; i++) |
| 73 | { |
| 74 | unsigned int nIndex = Hash(i, vKey); |
| 75 | // Checks bit nIndex of vData |
| 76 | if (!(vData[nIndex >> 3] & (1 << (7 & nIndex)))) |
| 77 | return false; |
| 78 | } |
| 79 | return true; |
| 80 | } |
| 81 | |
| 82 | bool CBloomFilter::contains(const COutPoint& outpoint) const |
| 83 | { |