feat(ds/enc): add bloom filter, FNV-1a and DJB2 hash units
continuous-integration/drone/push Build is passing

- core.enc.fnv1a: FNV-1a 32/64-bit non-cryptographic hash with UnitTest
- core.enc.djb2: DJB2 XOR/Add 32/64-bit hash variants with UnitTest
- core.ds.bloom: probabilistic bloom filter (Bloom_New/Add/Test/Clear/Free)
  using double hashing (FNV-1a32 + DJB2_32) with UnitTest
- core.ds.types: add TBloomFilter / PBloomFilter record
- asuro.pas: wire all three UnitTests into boot test suite
This commit is contained in:
Aaron committed 2026-03-08 13:58:33 +00:00
1 parent 7abb38ccbe
commit 2159578bdf
5 files changed
+687

No files matched your search

File diff suppressed because it is too large. Load diff
+26
View File
@@ -195,6 +195,32 @@ type
IsMinHeap : boolean;
end;
{ ------ Bloom Filter ------ }
{**
@abstract Pointer to a bloom filter.
**}
PBloomFilter = ^TBloomFilter;
{**
@abstract Probabilistic set-membership filter using double hashing.
@discussion The bit array is a flat kalloc'd byte buffer of
ceil(BitCount / 8) bytes. Membership tests use k independent
hash positions derived from two base hashes (FNV-1a + DJB2)
via double hashing: h_i(x) = (h1(x) + i * h2(x)) mod BitCount.
False positives are possible; false negatives are not.
@field Bits Pointer to the flat bit-array buffer.
@field BitCount Total number of bits in the filter (m).
@field HashCount Number of hash functions applied per element (k).
@field Count Number of elements inserted.
**}
TBloomFilter = record
Bits : void;
BitCount : uint32;
HashCount : uint32;
Count : uint32;
end;
implementation
end.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff