Overview of QuaZip
masterQIODevice API.repository·master·Indexed 21 days ago
https://github.com/emsec/halHAL (Hardware Analyzer) is a comprehensive netlist reverse engineering and manipulation framework that parses netlists from sources like FPGAs or ASICs into a graph-based representation for traversal and analysis.
QIODevice API.spdlog is a high-performance C++ logging library with the following key capabilities:
fmt library.OutputDebugString(..))argv or environment variables.pybind11 is a lightweight, header-only C++ library designed to create seamless Python bindings for existing C++ code. It uses compile-time introspection to minimize boilerplate, mapping C++ types to Python and vice versa. Because it is header-only, there is no need to link against additional libraries; everything is contained within a few header files.
Key benefits include:
constexpr for precomputed function signatures to optimize execution and binary size.HAWKEYE is a plugin designed for recovering symmetric cryptography from hardware circuits. It was developed as part of the academic research presented in the paper "HAWKEYE - Recovering Symmetric Cryptography From Hardware Circuits" (IACR Crypto'24).
To reproduce the results presented in the research or to see a concrete example application, you should refer to the official paper artifacts hosted by the IACR.
The pybind11 benchmark compares compilation time and module size against Boost.Python using a synthetic workload. The workload consists of a growing number of dummy classes (from 1 to 2048) where each class contains four methods with randomly generated signatures.
Key findings from the benchmark:
PYBIND11_MODULE(example, m) {
py::class_<cl034>(m, "cl034")
.def("fn_000", &cl034::fn_000)
.def("fn_001", &cl034::fn_001)
.def("fn_002", &cl034::fn_002)
.def("fn_003", &cl034::fn_003)
}HAL is a modular framework with several built-in plugins that extend its capabilities:
igraph algorithms.liberty gate library formats.When calling an overloaded function from Python, pybind11 uses a two-pass resolution strategy to determine the correct overload:
py::arg().noconvert())..noconvert()).Key Rules:
py::prepend() tag during registration to place a specific function at the beginning of the overload sequence, allowing it to be checked before built-in functions.If both passes fail, a TypeError is raised.
To avoid expensive copies and allow functions to modify NumPy arrays in-place, use Eigen::Ref<MatrixType> in your C++ function signatures.
How it works:
Eigen::Ref<const MatrixType>: pybind11 attempts to use Eigen::Map to point directly to the NumPy data. This requires matching data types (e.g., double vs float64) and compatible storage layouts. If incompatible, pybind11 falls back to making a temporary copy.Eigen::Ref<MatrixType> (non-const): pybind11 only allows the call if the NumPy array is writeable (a.flags.writeable == True). Modifications made in C++ will be reflected directly in the NumPy array.Limitations:
void scale_by_2(Eigen::Ref<Eigen::VectorXd> v) {
v *= 2;
}When binding C++ functions to Python, you must specify how memory and object lifetimes are managed to prevent crashes (like double-freeing static data) or resource leaks. pybind11 uses return_value_policy annotations passed to module_::def or class_::def to resolve ownership ambiguity.
Key Concepts:
py::return_value_policy::automatic. For pointers, this defaults to take_ownership. For other types, it uses move or copy.std::shared_ptr), you generally do not need to specify a return value policy, as the smart pointer handles lifetime tracking automatically./* Example: Preventing a crash when returning a pointer to static data */
Data *get_data() { return _data; }
// WRONG: Default policy assumes ownership and will try to delete static _data
m.def("get_data", &get_data);
// CORRECT: Use reference policy to avoid taking ownership
m.def("get_data", &get_data, py::return_value_policy::reference);When passing functions between C++ and Python, pybind11 creates wrapper code to translate invocations. This introduces computational overhead.
Avoid patterns where a function is copied back and forth between Python and C++ many times in a tight loop. The resulting C++ $\leftrightarrow$ Python roundtrips can significantly decrease performance.
Pybind11 can optimize performance for stateless functions (e.g., raw function pointers or lambdas without captured variables). If a stateless function is passed as an argument to another C++ function exposed in Python, pybind11 extracts the underlying C++ function pointer to bypass the Python roundtrip, resulting in zero overhead.
When binding C++ and Python, you have three primary strategies for handling data types across the language boundary:
Note on Type Conversions: While type conversions are highly ergonomic, they require a copy of the data to be made during every Python $\leftrightarrow$ C++ transition because the memory layouts of the C++ and Python versions of the same type typically differ.