#pragma once #include #include #define XED_ENCODER extern "C" { #include #include } namespace theo::obf::transform { using transform_t = std::function; class operation_t { public: enum type_t { add_op, sub_op, and_op, or_op, rol_op, ror_op, xor_op }; explicit operation_t(transform_t op, type_t type) : m_transform(op), m_type(type) {} virtual std::vector native(xed_inst_t* inst, std::size_t imm) = 0; type_t inverse() { return m_inverse_op[m_type]; } transform_t get_transform() { return m_transform; } private: transform_t m_transform; type_t m_type; std::map m_inverse_op = { {add_op, sub_op}, {sub_op, add_op}, {and_op, or_op}, {or_op, and_op}, {rol_op, ror_op}, {ror_op, rol_op}, {xor_op, xor_op}}; }; } // namespace theo::obf::transform