Skip to main content

quick_screen

Function quick_screen 

Source
pub fn quick_screen(data: &[u8], threshold: f64) -> ScreenResult
Expand description

Run the Shannon entropy pre-filter on data.

Builds a 256-bucket byte frequency table in one pass, computes H(X), and compares against threshold (bits).

§Arguments

  • data — raw byte slice. Empty input yields H(X) = 0.0 → Skip.
  • threshold — entropy threshold in bits. Values below this trigger Skip. A threshold of 0.0 means only completely constant streams are skipped.

§Complexity

O(N) in input length; O(1) in alphabet size (fixed 256 buckets).