BBloomFjord
Product

Product features · Probabilistic Bloom membership

01

Compare inserted keys with the bitmap while reviewing collisions, keeping a positive membership result separate from certainty.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Probabilistic Bloom membership

● ● ●BloomFjord●
A concrete starting point · Probabilistic Bloom membership ×
from hashlib import sha256

class Bloom:
    def __init__(self, width):
        if type(width) is not int or not 1 <= width <= 8192:
            raise ValueError("width.range")
        self.width, self.bits = width, 0
    def positions(self, key):
        if not isinstance(key, bytes) or len(key) > 1024:
            raise ValueError("key.bytes")
        digest = sha256(key).digest()
        return [int.from_bytes(digest[i:i+4], "big") % self.width
                for i in (0, 4, 8, 12)]
    def add(self, key):
        for position in self.positions(key):
            self.bits |= 1 << position
    def maybe_contains(self, key):
        return all(self.bits & (1 << p) for p in self.positions(key))
✳Store byte keys of at most 1024 bytes in a Bloom filter with one to 8192 bits.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗