OSDN Git Service

Implemented a simple padding scheme.
[slunkcrypt/SlunkCrypt.git] / frontend / src / utils.h
1 /******************************************************************************/
2 /* SlunkCrypt, by LoRd_MuldeR <MuldeR2@GMX.de>                                */
3 /* This work has been released under the CC0 1.0 Universal license!           */
4 /******************************************************************************/
5
6 #ifndef INC_UTILS_H
7 #define INC_UTILS_H
8
9 #include "platform.h"
10 #include <stdint.h>
11
12 typedef void (signal_handler_t)(int);
13
14 void init_terminal(void);
15 void setup_signal_handler(const int signo, signal_handler_t* const handler);
16 uint64_t swap_bytes_u64(const uint64_t value);
17 char* CHR_to_utf8(const CHR *const input);
18 uint64_t get_file_size(FILE* const file);
19 const CHR *get_file_name(const CHR *path);
20
21 #define GET_NIBBLE(X) ((X) & 0x0F)
22 #define SET_NIBBLE(X, Y) do { X = ((X) & 0xF0) | ((Y) & 0x0F); } while(0)
23
24 #endif