rolClass

Class for performing the ROL (Rotate Left) operation. More...

Public Functions

TypeName
constexprrol (const const_value< T > &val, const size_t &count)
rol (const T &val, const size_t &count)
constexproperator T () const

Private Properties

TypeName
const_value< T >value_

Detailed Description

The rol class template provides a mechanism for performing the ROL (Rotate Left) operation on values of type T . The class supports both compile-time and runtime ROL operations. The resulting rotated value is securely stored within the class, utilizing the const_value<T> wrapper for enhanced security. The ROL operation shifts the bits of a value to the left by a specified number of positions, with the shifted bits being wrapped around to the right side.

Template Parameters

  • T: The type of the value to be rotated.

  • bitcount: The bit width within which the rotation should occur. By default, this is set to the size of T in bits (e.g., 32 or 64 bits), which is calculated as sizeof(T) * CHAR_BIT .

Public Functions

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

Constructs a rol object and performs a compile-time ROL operation.

Definition

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

Detailed Description

This constructor performs the ROL operation at compile-time using constant values. The rotated value is computed using bitwise operations and stored securely in the value_ member. The operation ensures that the bits are rotated to the left by the specified count, with the shifted bits wrapping around to the right.

Parameters

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

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

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

Constructs a rol object and performs a runtime ROL operation.

Definition

libantispy::rol< T, bitcount >::rol

Detailed Description

This constructor performs the ROL operation at runtime using the impl_rol::impl function, which executes the operation within a virtual machine (VM). This approach enhances security by obfuscating the logic and making it harder to reverse engineer. The rotated value is stored securely in the value_ member.

Parameters

  • val: The value to be rotated, of type T .

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

constexpr operator T () const

Conversion operator to the underlying type T .

Definition

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

Detailed Description

This conversion operator allows the rol object to be implicitly converted to the underlying type T , providing easy access to the rotated value. This operator is particularly useful when the result of the ROL operation needs to be used directly in further computations or returned from a function.

Returns

The rotated value as a value of type T .

Private Properties

const_value< T > value_

Stores the result of the ROL operation securely.

Definition

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

Detailed Description

This member variable holds the result of the ROL operation, which is of type T . The value is stored as a const_value<T> to provide an additional layer of protection, ensuring that it is resistant to certain types of attacks.