pub struct HashFeed { /* private fields */ }Expand description
An analyst-supplied multi-algorithm known-good / known-bad hash set.
Hashes are stored as lowercase hex strings, partitioned by algorithm (auto-detected by length). Lookups normalize case and surrounding whitespace.
Implementations§
Source§impl HashFeed
impl HashFeed
Sourcepub fn insert_bad(&mut self, hash: &str) -> Result<(), FeedError>
pub fn insert_bad(&mut self, hash: &str) -> Result<(), FeedError>
Insert a known-bad hash (algorithm auto-detected).
Sourcepub fn insert_good(&mut self, hash: &str) -> Result<(), FeedError>
pub fn insert_good(&mut self, hash: &str) -> Result<(), FeedError>
Insert a known-good hash (algorithm auto-detected).
Sourcepub fn lookup_bad(&self, hash: &str) -> Option<HashMatch>
pub fn lookup_bad(&self, hash: &str) -> Option<HashMatch>
Look up a known-bad hash, returning a HashMatch on a hit.
Sourcepub fn is_known_good(&self, hash: &str) -> bool
pub fn is_known_good(&self, hash: &str) -> bool
True if the hash is in the known-good set (e.g. an NSRL subset).
Sourcepub fn load_bad_from_file(&mut self, path: &Path) -> Result<usize, FeedError>
pub fn load_bad_from_file(&mut self, path: &Path) -> Result<usize, FeedError>
Load known-bad hashes from a text/CSV file (one per line; # comments and
blank lines skipped; the first comma/tab/space-delimited field is taken).
Returns the number of valid hashes ingested; malformed lines are skipped.
Sourcepub fn load_good_from_file(&mut self, path: &Path) -> Result<usize, FeedError>
pub fn load_good_from_file(&mut self, path: &Path) -> Result<usize, FeedError>
Load known-good hashes from a text/CSV file (same format as
HashFeed::load_bad_from_file).
Sourcepub fn good_count(&self) -> usize
pub fn good_count(&self) -> usize
Total known-good hashes across all algorithms.