pub struct KnownBadDb { /* private fields */ }Expand description
Provenance-tracked malware hash lookup database.
Phase 1: backed by a HashMap (exact matching, zero false positives).
Phase 2 (future): might_be_malicious will be backed by an XOR filter
pre-screen, but the public API will remain unchanged.
Implementations§
Source§impl KnownBadDb
impl KnownBadDb
Sourcepub fn from_entries(
iter: impl IntoIterator<Item = ([u8; 32], BadFileInfo)>,
) -> Self
pub fn from_entries( iter: impl IntoIterator<Item = ([u8; 32], BadFileInfo)>, ) -> Self
Construct from an iterator of (sha256, info) pairs.
Sourcepub fn might_be_malicious(&self, sha256: &[u8; 32]) -> bool
pub fn might_be_malicious(&self, sha256: &[u8; 32]) -> bool
Fast pre-screen. Returns true if the hash MIGHT be in the database.
No false negatives. Phase 1: backed by HashMap (no false positives
either). Phase 2 will swap in an XOR filter pre-screen.
Sourcepub fn lookup(&self, sha256: &[u8; 32]) -> Option<&BadFileInfo>
pub fn lookup(&self, sha256: &[u8; 32]) -> Option<&BadFileInfo>
Exact lookup with full provenance. Returns None if definitely not present.
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl Freeze for KnownBadDb
impl RefUnwindSafe for KnownBadDb
impl Send for KnownBadDb
impl Sync for KnownBadDb
impl Unpin for KnownBadDb
impl UnsafeUnpin for KnownBadDb
impl UnwindSafe for KnownBadDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more