Various useful helper functions. More...
Functions | |
char * | _lc (char *in) |
Convert a char array to lowercase. More... | |
long int | _findoffset (byte *bin, size_t binlen, char *sigstart, size_t hlen) |
Find the offset of some offset marker in some arbitrary data. More... | |
void | _xorbuf (byte *iv, byte *buf, size_t xlen) |
XOR an input buffer with another buffer. More... | |
void | _dump (char *n, byte *d, size_t s) |
Dump binary data as hex to stderr. More... | |
Various useful helper functions.
void _dump | ( | char * | n, |
byte * | d, | ||
size_t | s | ||
) |
Dump binary data as hex to stderr.
[in] | n | Description, string. |
[in] | d | Data to print. |
[in] | s | Size of d. |
long int _findoffset | ( | byte * | bin, |
size_t | binlen, | ||
char * | sigstart, | ||
size_t | hlen | ||
) |
Find the offset of some offset marker in some arbitrary data.
Sample input:
If you look for the offset of "nacl" within that data, the function will return 9, which is the position within the data where the marker starts.
[in] | bin | Aribrary data where to look for the marker. |
[in] | binlen | The size of the data. |
[in] | sigstart | The offset marker. |
[in] | hlen | Size of the offset marker. |
char* _lc | ( | char * | in | ) |
Convert a char array to lowercase.
The supplied char array will be directly modified. Use a copy if you want to retain the original.
[in,out] | in | The char array to convert. |
void _xorbuf | ( | byte * | iv, |
byte * | buf, | ||
size_t | xlen | ||
) |
XOR an input buffer with another buffer.
Both buffers have to have the same size. The input buffer will bei modified directly.
[in] | iv | The buffer to XOR with. |
[in,out] | buf | The buffer which will be XORed with 'iv'. |
[in] | xlen | The size of the buffers (they must have the same size). |