Skip to content

Instantly share code, notes, and snippets.

@gallypette
Created June 29, 2022 13:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gallypette/e0355a402133fece2dcaea3c45f86c62 to your computer and use it in GitHub Desktop.
Save gallypette/e0355a402133fece2dcaea3c45f86c62 to your computer and use it in GitHub Desktop.

FIRST mermaid graph

Keeping in mind the "Latency Numbers Every Programmer Should Know", i.e. network access is expensive.

Online request (service is provided by hashlookup online API)

  • existing / not existing have the same high cost
  • network access takes a long time
  • leak every hash to hashlookup service
sequenceDiagram
    Alice->>Hashlookup: Do you have $HASH?
    alt is existing 
        Hashlookup->>Alice: details($HASH)
    else is not existing 
        Hashlookup->>Alice: $HASH not existing
    end

Offline request (service is provided by a bloom filter file)

  • existing / not existing have the same low cost
  • there is a probability of false positive
  • no details available
sequenceDiagram
    Alice->>Filter: Do you have $HASH?
    alt seems existing 
        Filter->>Alice: $HASH is probably existing
    else is not existing 
        Filter->>Alice: $HASH not existing
    end

Hybrid request (service is provided by a bloom filter file and the online API)

  • existing / not existing have a low cost
  • getting hash's detail still have a high cost but occurs less often
  • there is a probability of hitting some false positives where the filter says a %HASH is in the dataset but a query on the service yields no details.
sequenceDiagram
    Alice->>Filter: Do you have $HASH?
    alt seems existing 
        Filter->>Alice: $HASH is probably existing
        Alice->>Hashlookup: Do you have $HASH?
        alt is existing 
            Hashlookup->>Alice: details($HASH)
        else is not existing (False Positive)
            Hashlookup->>Alice: $HASH not existing
        end
    else is not existing 
        Filter->>Alice: $HASH not existing
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment