2022-05-02 18:01:12 +02:00
|
|
|
#include <why2/flags.h>
|
|
|
|
|
2022-06-12 17:15:07 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2022-07-01 18:45:44 +02:00
|
|
|
//VARIABLES
|
|
|
|
static char encryptionSeparator = '.'; //NOPE > DO NOT TOUCH THIS, USE setEncryptionSeparator instead <
|
|
|
|
static unsigned long keyLength = 50; //LENGTH OF KEY > DO NOT TOUCH THIS, USE setKeyLength instead <
|
|
|
|
|
|
|
|
//GETTERS
|
2022-06-18 18:28:33 +02:00
|
|
|
char getEncryptionSeparator()
|
|
|
|
{
|
|
|
|
return encryptionSeparator;
|
|
|
|
}
|
|
|
|
|
2022-05-29 17:45:34 +02:00
|
|
|
unsigned long getKeyLength()
|
2022-05-03 18:36:44 +02:00
|
|
|
{
|
|
|
|
return keyLength;
|
|
|
|
}
|
|
|
|
|
2022-05-27 17:25:02 +02:00
|
|
|
inputFlags noFlags()
|
|
|
|
{
|
2022-06-11 18:53:25 +02:00
|
|
|
return (inputFlags) {0, 0, 1};
|
2022-05-27 17:25:02 +02:00
|
|
|
}
|
|
|
|
|
2022-06-12 16:21:12 +02:00
|
|
|
outputFlags noOutput(unsigned char exitCode)
|
2022-06-12 16:17:09 +02:00
|
|
|
{
|
2022-06-19 16:22:28 +02:00
|
|
|
char *emptyText = malloc(1); //TEXT
|
|
|
|
emptyText[0] = '\0';
|
2022-06-19 16:20:52 +02:00
|
|
|
|
2022-06-19 16:22:28 +02:00
|
|
|
char *emptyKey = malloc(getKeyLength() + 1); //KEY
|
2022-06-19 17:19:03 +02:00
|
|
|
for (int i = 0; i < (int) getKeyLength(); i++)
|
2022-06-19 16:20:52 +02:00
|
|
|
{
|
2022-06-19 16:22:28 +02:00
|
|
|
emptyKey[i] = 'x';
|
2022-06-19 16:20:52 +02:00
|
|
|
}
|
2022-06-19 16:22:28 +02:00
|
|
|
emptyKey[getKeyLength()] = '\0';
|
2022-06-12 17:15:07 +02:00
|
|
|
|
2022-06-19 16:22:28 +02:00
|
|
|
return (outputFlags) { emptyText, emptyKey, 0, 0, exitCode };
|
2022-06-12 16:17:09 +02:00
|
|
|
}
|
|
|
|
|
2022-07-01 18:45:44 +02:00
|
|
|
//SETTERS
|
2022-06-18 18:28:33 +02:00
|
|
|
void setEncryptionSeparator(char encryptionSeparatorNew)
|
|
|
|
{
|
2022-06-18 18:37:39 +02:00
|
|
|
if (encryptionSeparatorNew == '\0') return;
|
|
|
|
|
2022-06-18 18:28:33 +02:00
|
|
|
encryptionSeparator = encryptionSeparatorNew;
|
|
|
|
}
|
|
|
|
|
2022-05-03 18:36:44 +02:00
|
|
|
void setKeyLength(int keyLengthNew)
|
|
|
|
{
|
|
|
|
keyLength = keyLengthNew;
|
2022-05-02 18:01:12 +02:00
|
|
|
}
|