as_xorClass

Template class for performing XOR operations with structural randomization. More...

Public Functions

TypeName
constexpras_xor (const const_value< T > &a, const const_value< T > &b)
as_xor (const T &a, const T &b)
constexproperator T () const

Private Properties

TypeName
const_value< T >value_

Detailed Description

The as_xor class provides a mechanism to perform XOR (exclusive OR) operations on values of type T . This class supports XOR operations both at compile-time and runtime, making it versatile for various use cases where XOR logic is needed. Additionally, the resulting XOR value is stored securely within the class, with the structure layout randomized to protect against memory inspection or tampering.

XOR is a fundamental operation in many cryptographic algorithms and data obfuscation techniques, making this class useful in scenarios where data integrity and security are of concern.

Template Parameters

  • T: The type of the values to be XORed. This type should support the XOR ( ^ ) operator.

Public Functions

constexpr as_xor (const const_value< T > &a, const const_value< T > &b)

Constructs an as_xor object with two constant values.

Definition

constexpr libantispy::as_xor< T >::as_xor

Detailed Description

This constructor performs the XOR operation at compile-time using two const_value<T> objects. The resulting XOR value is computed and stored securely within the object, ensuring that it is resistant to certain types of attacks. Compile-time XOR operations are particularly useful in scenarios where the XOR logic needs to be embedded directly in the compiled code for efficiency or security purposes.

Parameters

  • a: The first constant value to be XORed, represented as a const_value<T> .

  • b: The second constant value to be XORed, represented as a const_value<T> .

as_xor (const T &a, const T &b)

Constructs an as_xor object by performing a secure XOR operation at runtime.

Definition

libantispy::as_xor< T >::as_xor

Detailed Description

This constructor takes two runtime values, a and b , and performs a secure XOR operation on them using a virtual machine (VM) to obfuscate the process. The result of this XOR operation is then securely stored in the as_xor object. The use of a VM for the XOR operation adds an additional layer of security by making the operation more resistant to reverse engineering and tampering.

Parameters

  • a: The first value to be XORed, of type T . This value is provided at runtime.

  • b: The second value to be XORed, of type T . This value is provided at runtime.

constexpr operator T () const

Conversion operator to the underlying type T .

Definition

constexpr libantispy::as_xor< T >::operator T

Detailed Description

This conversion operator allows the as_xor object to be implicitly converted to the underlying type T , enabling easy access to the computed XOR value. This operator is particularly useful when the result of the XOR operation needs to be used directly in further computations or returned from a function. The conversion is designed to maintain the security of the stored value while providing convenient access.

Returns

The computed XOR result as a value of type T .

Private Properties

const_value< T > value_

Stores the result of the XOR operation securely.

Definition

const_value<T> libantispy::as_xor< T >::value_

Detailed Description

This member variable holds the result of the XOR operation, which is of type T . The value is stored as a const_value<T> to provide an additional layer of protection, ensuring that the XOR result is immutable and securely stored throughout the lifetime of the as_xor object. The security of this value is further augmented by the structural randomization applied to the class.