rorClass

Template class for performing ROR (Rotate Right) operations. More...

Public Functions

TypeName
constexprror (const const_value< T > &val, const size_t &count)
ror (const T &val, const size_t &count)
constexproperator T () const

Private Properties

TypeName
const_value< T >value_

Detailed Description

The ror class provides a mechanism for rotating the bits of a value to the right (ROR). It supports both compile-time and runtime ROR operations. The compile-time variant uses constant values to perform the rotation, while the runtime variant executes the rotation using a secure implementation provided by a virtual machine (VM).

Template Parameters

  • T: The type of the value to be rotated. This type must support bitwise operations.

  • bitcount: The number of bits in the type T . This defaults to the bit width of T .

Public Functions

constexpr ror (const const_value< T > &val, const size_t &count)

Constructs a ror object using compile-time values.

Definition

constexpr libantispy::ror< T, bitcount >::ror

Detailed Description

This constructor performs the ROR operation at compile-time using the provided const_value<T> object and rotation count. The result of the ROR operation is stored securely in the value_ member variable.

Parameters

  • val: The value to be rotated, wrapped in a const_value<T> .

  • count: The number of positions to rotate the bits to the right.

ror (const T &val, const size_t &count)

Constructs a ror object using runtime values.

Definition

libantispy::ror< T, bitcount >::ror

Detailed Description

This constructor performs the ROR operation at runtime using the provided value and rotation count. The rotation logic is executed within a virtual machine (VM) to enhance security, making the operation more resistant to reverse engineering and tampering.

Parameters

  • val: The value to be rotated.

  • count: The number of positions to rotate the bits to the right.

constexpr operator T () const

Conversion operator to the underlying type T .

Definition

constexpr libantispy::ror< T, bitcount >::operator T

Detailed Description

This conversion operator allows the ror object to be implicitly converted to the underlying type T , enabling easy access to the rotated value. The conversion is designed to maintain the security of the stored value while providing convenient access.

Returns

The rotated value as a value of type T .

Private Properties

const_value< T > value_

Stores the result of the ROR operation securely.

Definition

const_value<T> libantispy::ror< T, bitcount >::value_

Detailed Description

This member variable holds the result of the ROR 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 rotated value is immutable and securely stored throughout the lifetime of the ror object. The security of this value is further augmented by the structural randomization applied to the class.