ELC 2
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
#define LINUX 1
|
||||
|
||||
#ifndef UTILS_H_
|
||||
#define UTILS_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <chrono>
|
||||
#include <bitset>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <filesystem>
|
||||
|
||||
#define LINUX 1
|
||||
#include <vector>
|
||||
|
||||
#define PEM_BUFSIZE_TEXT 1024
|
||||
#define BitVal(data, y) ((data >> y) & 1) /** Return Data.Y value **/
|
||||
@@ -16,21 +22,11 @@
|
||||
|
||||
#define PEM_BUFSIZE_TEXT 1024
|
||||
|
||||
#ifndef BYTE
|
||||
|
||||
typedef uint8_t BYTE;
|
||||
#endif
|
||||
|
||||
#ifndef WORD
|
||||
typedef uint16_t WORD;
|
||||
#endif
|
||||
|
||||
#ifndef DWORD
|
||||
typedef uint32_t DWORD;
|
||||
#endif
|
||||
|
||||
#ifndef DATE
|
||||
typedef uint32_t DATE;
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -56,19 +52,37 @@ DateAndTime getCurrentDateTimeAsCODESYSDateTime();
|
||||
uint16_t convertToCODESYSDate(int day, int month, int year);
|
||||
uint16_t convertToCODESYSTime(int hour, int minute);
|
||||
DATE getLicDate();
|
||||
int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext);
|
||||
string getDate();
|
||||
int encrypt(const unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext);
|
||||
bool CompareFiles(const char *fileName, const char *fileName1);
|
||||
unsigned short crc16(const unsigned char* data_p, unsigned char length);
|
||||
int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext);
|
||||
int decrypt(const unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext);
|
||||
string convertToString(char* a, int size);
|
||||
std::string base64_encode_ai(const std::string &input);
|
||||
std::string base64_decode_ai(const std::string &encoded);
|
||||
map<string, string> getArguments(int argc, char *argv[]);
|
||||
map<string, const char*> mapArguments(int argc, char *argv[]);
|
||||
unordered_map<string, string> getArguments(int argc, char *argv[]);
|
||||
unordered_map<string, const char*> mapArguments(int argc, char *argv[]);
|
||||
char* getCharArray(string source);
|
||||
void getCharsFromString1(string source, char *charArray);
|
||||
void getCharsFromString(string& source, char *charArray, int length);
|
||||
string getCompletePath(string fileName);
|
||||
char* getFileContent(string fileName);
|
||||
void appendStringToVector(const std::string& str, std::vector<unsigned char>& charVector);
|
||||
void coutVector (std::vector<unsigned char>& charVector);
|
||||
uint16_t calculateCRC16(std::vector<unsigned char>& charVector);
|
||||
uint32_t bytesToDword(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4);
|
||||
uint32_t bytesToWord(uint8_t byte1, uint8_t byte2);
|
||||
vector<unsigned char> joinVectors(const std::vector<unsigned char>& vector1, const std::vector<unsigned char>& vector2);
|
||||
string readFileToString(const std::string& filename, std::size_t sizeS);
|
||||
bool readFile(string fileName, vector<char> &output);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user