Skip to content

File lt_utils.c

FileList > api > lt_utils.c

Go to the source code of this file.

  • #include "lt_utils.h"

Public Functions

Type Name
void hexdump (const uint8_t * buf, size_t len, uint32_t offset=0, uint8_t width=16)
Print data pointed to by buf in hexdump-like format (hex+ASCII).
char * lt_btox (const uint8_t * src, int len, char * dest)
Convert a byte array to hexadecimal string.
void lt_rand_bytes (uint8_t * buf, size_t len)
Generate random bytes using rand().
uint8_t * lt_xtob (const char * src, int len, uint8_t * dest)
Convert a hexadecimal string to byte array.

Public Functions Documentation

function hexdump

Print data pointed to by buf in hexdump-like format (hex+ASCII).

void hexdump (
    const uint8_t * buf,
    size_t len,
    uint32_t offset=0,
    uint8_t width=16
) 

Parameters:

  • buf source pointer
  • len how many bytes to print
  • offset increment printed offset by this value
  • width how many bytes on a line

function lt_btox

Convert a byte array to hexadecimal string.

char * lt_btox (
    const uint8_t * src,
    int len,
    char * dest
) 

Parameters:

  • src source byte array
  • len source length (bytes)
  • dest destination string

Returns:

destination string

function lt_rand_bytes

Generate random bytes using rand().

void lt_rand_bytes (
    uint8_t * buf,
    size_t len
) 

Parameters:

  • buf destination pointer
  • len how many bytes to generate

function lt_xtob

Convert a hexadecimal string to byte array.

uint8_t * lt_xtob (
    const char * src,
    int len,
    uint8_t * dest
) 

Parameters:

  • src source string
  • len source length (chars)
  • dest destination byte array

Returns:

destination byte array


The documentation for this class was generated from the following file cores/common/base/api/lt_utils.c