patternscanner

Build API Crate dependency status

A high performance pattern scanner for bytes.

This pattern scanner supports both single-threaded as well as multi-threaded scanning. Additionally, it is possible to include a wildcard ? in the pattern.

Installation

Add this crate as a dependency to your Cargo.toml file.

toml [dependencies] patternscanner = "0.4.0"

Example

```rust // Use the multithreaded pattern scanners use patternscanner::mt::{patternscan, patternscan_all};

// Scan for a single match of the pattern let result = patternscan( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x33, 0x42, 0x07, 0x08, 0x09], "33 35", ).unwrap(); asserteq!(result, Some(3));

// Scan for a single match of the pattern with a wildcard let result = patternscan( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x42, 0x33, 0x35, 0x69, 0x09], "33 ? 42", ).unwrap(); asserteq!(result, Some(3));

// Scan for all matches of the pattern with a wildcard let result = patternscanall( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x42, 0x33, 0x35, 0x69, 0x09], "33 35 ?", ).unwrap(); assert_eq!(result, [3, 6]); ```

License

MIT

Contributing

Contributions are welcome.