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:
2026-03-08 13:58:33 +00:00
parent 7abb38ccbe
commit 2159578bdf
5 changed files with 687 additions and 0 deletions
+6
View File
@@ -104,6 +104,9 @@ uses
driver.storage.vfs,
driver.video,
arch.x86.memory.virtual,
core.enc.fnv1a,
core.enc.djb2,
core.ds.bloom,
app.volcmd,
driver.storage.vol.mgr,
app.vterminal,
@@ -344,6 +347,9 @@ begin
core.ds.prio.UnitTest;
driver.storage.vfs.UnitTest;
driver.storage.test.UnitTest;
core.enc.fnv1a.UnitTest;
core.enc.djb2.UnitTest;
core.ds.bloom.UnitTest;
{ Initialize driver.video.desktop environment }
boot.splash.update(100, 'Booting desktop...');
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