{"id":49889295,"url":"https://github.com/santhsecurity/flashsieve","last_synced_at":"2026-05-15T20:09:15.674Z","repository":{"id":350356890,"uuid":"1205399159","full_name":"santhsecurity/flashsieve","owner":"santhsecurity","description":"Storage-level pre-filtering for pattern matching","archived":false,"fork":false,"pushed_at":"2026-04-10T02:23:19.000Z","size":1313,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-10T02:42:18.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/santhsecurity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"AUDIT_FINDINGS_FLASHSIEVE.md","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-08T23:42:26.000Z","updated_at":"2026-04-10T02:23:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/santhsecurity/flashsieve","commit_stats":null,"previous_names":["santhsecurity/flashsieve"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/santhsecurity/flashsieve","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Fflashsieve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Fflashsieve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Fflashsieve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Fflashsieve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/santhsecurity","download_url":"https://codeload.github.com/santhsecurity/flashsieve/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santhsecurity%2Fflashsieve/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:05:40.333Z","status":"ssl_error","status_checked_at":"2026-05-15T20:05:38.672Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-15T20:09:14.970Z","updated_at":"2026-05-15T20:09:15.669Z","avatar_url":"https://github.com/santhsecurity.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flashsieve\n\n[![crates.io](https://img.shields.io/crates/v/flashsieve.svg)](https://crates.io/crates/flashsieve)\n[![docs.rs](https://docs.rs/flashsieve/badge.svg)](https://docs.rs/flashsieve)\n[![license](https://img.shields.io/crates/l/flashsieve.svg)](LICENSE)\n\n**Storage-level pre-filtering for pattern matching.**\n\n`flashsieve` builds per-block byte histograms and 2-byte n-gram bloom filters,\nthen uses them to answer which blocks *might* contain matches. If a block cannot\ncontain a pattern, it is skipped entirely—saving CPU, I/O, and memory at scale.\n\n---\n\n## Installation\n\n```toml\n[dependencies]\nflashsieve = \"0.1\"\n```\n\nMinimum supported Rust version: **1.85**.\n\n---\n\n## Quick Start\n\n```rust\nuse flashsieve::{BlockIndexBuilder, ByteFilter, NgramFilter};\n\nlet mut block_a = vec![b'x'; 256];\nlet mut block_b = vec![b'y'; 256];\nblock_a[..6].copy_from_slice(b\"secret\");\nblock_b[..5].copy_from_slice(b\"token\");\nlet patterns: [\u0026[u8]; 2] = [b\"secret\", b\"token\"];\n\nlet index = BlockIndexBuilder::new()\n    .block_size(256)\n    .bloom_bits(512)\n    .build_streaming([block_a, block_b].into_iter())?;\n\nlet byte_filter = ByteFilter::from_patterns(\u0026patterns);\nlet ngram_filter = NgramFilter::from_patterns(\u0026patterns);\n\nlet candidates = index.candidate_blocks(\u0026byte_filter, \u0026ngram_filter);\nassert_eq!(candidates.len(), 1);\nassert_eq!(candidates[0].length, 512);\n# Ok::\u003c(), flashsieve::Error\u003e(())\n```\n\n---\n\n## What It Does\n\n| Component | Purpose |\n|-----------|---------|\n| `BlockIndexBuilder` | Constructs indexes from raw bytes or streaming blocks |\n| `BlockIndex` | In-memory index with per-block histograms \u0026 bloom filters |\n| `FileBloomIndex` | File-level bloom union for fast n-gram rejection before per-block scans |\n| `MmapBlockIndex` | Zero-parse, zero-copy queries over serialized indexes |\n| `IncrementalBuilder` | Append new blocks to existing indexes without rebuilding |\n| `ByteFilter` | Reject blocks that don't contain all required bytes |\n| `NgramFilter` | Reject blocks that don't contain all required 2-byte n-grams |\n\n---\n\n## Bloom Filter Math\n\nThe theoretical false-positive rate for a Bloom filter with:\n\n- `m` = number of bits  \n- `n` = number of distinct n-grams inserted  \n- `k` = number of hash functions (`k = 3` in this crate)\n\nis approximately:\n\n```text\nFPR ≈ (1 - e^(-kn/m))^k\n```\n\nFor the optimal number of hash functions `k = (m/n) × ln(2)`:\n\n```text\nFPR ≈ 0.6185^(m/n)\n```\n\nFor filters with **≥4096 bits**, `flashsieve` allocates an exact 65,536-bit pair\ntable, giving **zero false positives** for all possible 2-byte n-gram queries.\n\n---\n\n## Safety\n\nThis crate keeps `unsafe` usage narrowly scoped to hot-path bloom-filter word\nloads where index validity is proven by construction. All serialized input is\nvalidated (magic, version, checksum, bounds) before use—corrupt files return\ntyped errors rather than panicking.\n\n---\n\n## License\n\nLicensed under the MIT license ([LICENSE](LICENSE) or https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanthsecurity%2Fflashsieve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanthsecurity%2Fflashsieve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanthsecurity%2Fflashsieve/lists"}