WHY2/include/flags.h

71 lines
2.9 KiB
C
Raw Normal View History

2022-03-20 18:12:25 +01:00
#ifndef WHY2_FLAGS_H
#define WHY2_FLAGS_H
//CONSTS
const enum EXIT_CODES //exit codes you fucking idiot
{
SUCCESS = 0, //EXIT CODE FOR SUCCESSFUL RUN
INVALID_KEY = 1, //EXIT VALUE FOR INVALID KEY
INVALID_TEXT = 4, //EXIT VALUE FOR INVALID TEXT
DOWNLOAD_FAILED = 2, //EXIT VALUE FOR versions.json DOWNLOAD FAILED
UPDATE_FAILED = 3 //EXIT VALUE FOR UPDATE FAILED
};
2022-03-20 18:12:25 +01:00
#define VERSION "v4.3.2" //VERSION OF CURRENT BUILD > DO NOT TOUCH THIS <
#define VERSIONS_URL "https://raw.githubusercontent.com/ENGO150/WHY2/release/versions.json" //URL FOR GETTING versions.json
#define VERSIONS_NAME "/tmp/why2-versions.json" //do I have to explain this?
2022-04-04 18:07:42 +02:00
2022-06-11 17:04:15 +02:00
#define UPDATE_URL "https://github.com/ENGO150/WHY2.git" // REPOSITORY URL FOR UPDATES (YOU DON'T SAY)
#define UPDATE_NAME "/tmp/why2-update" // fuck you
2022-06-11 18:54:34 +02:00
#define UPDATE_COMMAND "tmux new-session -d \"cd {DIR} && make install\""
2022-06-11 17:04:15 +02:00
#define TEST_TEXT "aAzZ( )!?#\\/śŠ <3|420*;㍿㊓ㅅΔ♛👶🏿" //TEST TEXT FOR ENCRYPTION IN why2-test BINARY
2022-05-05 18:26:10 +02:00
#define TEXT_TO_ENCRYPT "Some text yk" //THIS TEXT WILL BE ENCRYPTED IN why2-app BINARY
#define CLEAR_SCREEN "\e[1;1H\e[2J" //TEXT FOR UNIX CLEAR SCREEN
#define CURL_TIMEOUT 3 //if you need comment explaining, what the fuck is timeout, don't change WHY2's code, alright? thx, love ya
2022-05-05 18:26:10 +02:00
#define NOT_FOUND_TRIES 10 //NUMBER OF TRIES FOR DOWNLOADING versions.json
2022-05-21 18:37:24 +02:00
#define DEPRECATED __attribute__((deprecated)) //SAME COMMENT AS VERSIONS_NAME'S
2022-06-19 17:15:23 +02:00
#define UNUSED __attribute__((unused)) //SAME COMMENT AS DEPRECATED'S
2022-05-05 18:38:30 +02:00
typedef char boolean;
typedef struct
2022-05-05 18:50:45 +02:00
{
boolean noCheck; //BOOLEAN FOR SKIPPING VERSION CHECK
boolean noOutput; //BOOLEAN FOR NOT PRINTING OUTPUT WHEN ENCRYPTING/DECRYPTING
boolean update; //BOOLEAN FOR UPDATING YOUR WHY VERSION IF OLD IS USED
2022-05-05 19:03:53 +02:00
} inputFlags;
typedef struct
2022-05-05 19:03:53 +02:00
{
2022-05-06 18:14:45 +02:00
char *outputText; //VARIABLE FOR ENCRYPTED/DECRYPTED TEXT
char *usedKey; //VARIABLE FOR USED/GENERATED KEY
unsigned long unusedKeySize; //VARIABLE FOR COUNT OF UNUSED CHARACTERS IN KEY
unsigned long repeatedKeySize; //VARIABLE FOR COUNT OF REPEATED CHARACTERS IN KEY (basically reversed unusedKeySize)
unsigned long elapsedTime; //VARIABLE FOR ELAPSED TIME IN MICROSECONDS => 1s = 1000000µs
boolean exitCode; //VARIABLE FOR EXIT CODE
2022-05-06 17:43:00 +02:00
} outputFlags;
2022-05-05 18:50:45 +02:00
//NOTE: Variables were moved to 'flags.c' to force y'all using getters
2022-05-04 18:42:30 +02:00
//GETTERS
char getEncryptionSeparator();
2022-05-29 17:45:34 +02:00
unsigned long getKeyLength();
2022-07-10 17:40:32 +02:00
inputFlags defaultFlags(); //THIS GENERATES inputFlags WITH DEFAULT VALUES
2022-07-10 18:07:21 +02:00
inputFlags getFlags(); //RETURNS USED FLAGS
outputFlags noOutput(boolean exitCode); //SAME AS defaultFlags() BUT FOR outputFlags
//SETTERS
void setEncryptionSeparator(char encryptionSeparatorNew);
void setKeyLength(int keyLengthNew);
2022-07-10 18:07:21 +02:00
void setFlags(inputFlags newFlags); //.... whatcha think?
2022-05-04 18:42:30 +02:00
//RANDOM SHIT THAT DOESN'T FIT IN MISC, SO I PUT IN HERE
int encryptionOperation(int text, int encryptedText);
2022-04-07 17:26:41 +02:00
#endif