--- gvpe/src/util.h 2013/07/16 16:44:37 1.31 +++ gvpe/src/util.h 2014/01/09 08:15:05 1.34 @@ -37,8 +37,6 @@ #include #include -#include - #include "gettext.h" #include "slog.h" @@ -127,10 +125,25 @@ // run a shell script (or actually an external program). pid_t run_script (const run_script_cb &cb, bool wait); +void hexdump (const char *header, void *data, int len); + #if ENABLE_HTTP_PROXY u8 *base64_encode (const u8 *data, unsigned int len); #endif +/* always take more or less the same time to compare */ +bool slow_memeq (const void *a, const void *b, int len); + +/*****************************************************************************/ + +void rand_fill (void *data, int len); + +template +inline void rand_fill (T &t) +{ + rand_fill (&t, sizeof (T)); +} + /*****************************************************************************/ // run work_cb in another thread, call done_cb in main thread when finished