KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
Loading...
Searching...
No Matches
KittyUtils::Data Namespace Reference

Provides utility functions for data. More...

Functions

bool fromHex (std::string in, void *data)
 Converts a hexadecimal string to a binary data buffer.
std::string toHex (const void *data, const size_t dataLength)
 Converts binary data to a hexadecimal string.
template<typename T>
std::string toHex (const T &data)
 Converts a binary representation of a type T to a hexadecimal string.
template<size_t rowSize = 8, bool showASCII = true>
std::string hexDump (const void *address, size_t len)
 Hex dumps the memory block at the specified address.

Detailed Description

Provides utility functions for data.

Function Documentation

◆ fromHex()

bool KittyUtils::Data::fromHex ( std::string in,
void * data )

Converts a hexadecimal string to a binary data buffer.

Note
data buffer must be large enough to fit.
Parameters
inThe hexadecimal string to convert.
dataPointer to the destination buffer where the binary data will be stored.
Returns
True if the conversion was successful, false otherwise.

◆ hexDump()

template<size_t rowSize = 8, bool showASCII = true>
std::string KittyUtils::Data::hexDump ( const void * address,
size_t len )

Hex dumps the memory block at the specified address.

Template Parameters
rowSizeThe size of each row in the hex dump. Default is 8 bytes.
showASCIIWhether to include ASCII representation of the memory block. Defult is true.
Parameters
addressPointer to the start of the memory block to dump.
lenLength of the memory block to dump.
Returns
A string containing the hex dump of the memory block.

This function generates a human-readable hex dump of a memory block. It prints the address, hexadecimal values, and ASCII representation of the block. The dump is formatted into rows of specified size, and each row includes the offset, byte values, and ASCII characters. The ASCII representation only includes printable characters, and non-printable characters are represented by '.'.

◆ toHex() [1/2]

template<typename T>
std::string KittyUtils::Data::toHex ( const T & data)

Converts a binary representation of a type T to a hexadecimal string.

Template Parameters
TThe type of the binary data.
Parameters
dataThe instance of type T to convert.
Returns
A hexadecimal string representation of the binary data.
Here is the call graph for this function:

◆ toHex() [2/2]

std::string KittyUtils::Data::toHex ( const void * data,
const size_t dataLength )

Converts binary data to a hexadecimal string.

Parameters
dataPointer to the source binary data.
dataLengthLength of the binary data.
Returns
A hexadecimal string representation of the binary data.
Here is the caller graph for this function: