This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
util.h
51 lines (47 loc) · 1.53 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <sys/select.h>
#include <time.h>
#include <signal.h>
#include <iomanip>
#include <sstream>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <openssl/rand.h>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/hmac.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/err.h>
#include <filesystem>
#include <fstream>
#include <vector>
#include <openssl/bn.h>
#include <openssl/dh.h>
#define DEBUG_OFF
#ifdef DEBUG_ON
#define DEBUG_PRINT(x) printf("[DEBUG]: "); printf x; printf("\n"); fflush(stdout);
#else
#define DEBUG_PRINT(x)
#endif
using namespace std;
unsigned char * readBinaryFile(string filename, int* len);
bool writeBinaryFile(std::string filename,unsigned char * buffer,int size);
std::string getPath(std::string username);
std::string Base64Encode(const unsigned char* data, size_t length);
unsigned char* Base64Decode(const std::string& encodedData, size_t& outLength);
std::string buildStringFromUnsignedChar(unsigned char * buffer, int dimension);
std::vector<std::string> getWords(std::string buffer);
std::vector<std::string> splitStringByNewline(const std::string& inputString);
std::string joinStringsByNewline(const std::vector<std::string>& inputVector);
std::vector<std::string> getLastElements(const std::vector<std::string>& inputVector, int t);