Skip to content
/ sapeaob Public

A compilation-time AoB pattern scanning library

License

Notifications You must be signed in to change notification settings

etra0/sapeaob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SapeAOB - A fast compile time function generation for pattern scans.

A fast micro-library which aids to create pattern scanning functions at compile time to enjoy that sweet compiler optimizations!

Usage

std::vector<std::uint8_t> test_arr{0xFF, 0xAA, 0xDF, 0xCC};
// You can store the pattern to do the scan later. `sapeaob::ANY` corresponds
// to a wildcard in the pattern.
sapeaob::pattern<0xAA, sapeaob::ANY, 0xCC> p{};
  
// You can scan a vector
std::uintptr_t result = p.scan_match(test_arr.begin(), test_arr.size());
CHECK(result == reinterpret_it(test_arr.begin() + 1));

// Or an array, or anything as long as you can offset it!
std::uint8_t test_arr2[] = {0xCC, 0xFF, 0xAA, 0xEE, 0xCC};
result = p.scan_match(test_arr2, sizeof(test_arr2));
CHECK(result == reinterpret_cast<std::uintptr_t>(test_arr2 + 2));

Benchmark

You can check how fast is sapeAOB compared to other two libraries in this repository.

About

A compilation-time AoB pattern scanning library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published