2020-08-19 21:24:32 +08:00
|
|
|
/*
|
2020-08-20 03:38:21 +08:00
|
|
|
*
|
2020-08-19 21:24:32 +08:00
|
|
|
* Various Utilities
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010, Flavio D. Garcia, Peter van Rossum, Roel Verdult
|
2020-08-20 03:38:21 +08:00
|
|
|
* and Ronny Wichers Schreur. Radboud University Nijmegen
|
2020-08-19 21:24:32 +08:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2020-08-20 03:38:21 +08:00
|
|
|
*
|
2020-08-19 21:24:32 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UTIL_H_
|
|
|
|
#define _UTIL_H_
|
|
|
|
|
2020-08-20 03:38:21 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2020-08-19 21:24:32 +08:00
|
|
|
|
2020-08-20 03:38:21 +08:00
|
|
|
#include <stdint.h>
|
2020-08-19 21:24:32 +08:00
|
|
|
|
|
|
|
#define AEND "\x1b[0m"
|
|
|
|
|
|
|
|
#define _BLUE_(s) "\x1b[34m" s AEND
|
|
|
|
#define _RED_(s) "\x1b[31m" s AEND
|
|
|
|
#define _GREEN_(s) "\x1b[32m" s AEND
|
|
|
|
#define _YELLOW_(s) "\x1b[33m" s AEND
|
|
|
|
#define _MAGENTA_(s) "\x1b[35m" s AEND
|
|
|
|
#define _CYAN_(s) "\x1b[36m" s AEND
|
|
|
|
#define _WHITE_(s) "\x1b[37m" s AEND
|
|
|
|
|
2020-08-20 03:38:21 +08:00
|
|
|
void num_to_bytes(uint64_t n, size_t len, uint8_t *dst);
|
|
|
|
void print_bytes(const uint8_t *pbtData, const size_t szLen);
|
2020-08-19 21:24:32 +08:00
|
|
|
|
2020-08-20 03:38:21 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2020-08-19 21:24:32 +08:00
|
|
|
#endif // _UTIL_H_
|