created function checkText
this checks if text has some content
This commit is contained in:
parent
ac82127bcc
commit
4e0a0c7a27
@ -7,6 +7,7 @@ void checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF
|
|||||||
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
|
void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION
|
||||||
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
|
void deallocateOutput(outputFlags flags); //DEALLOCATES flags
|
||||||
void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
|
void checkKey(char *key, inputFlags flags); //CHECKS IF KEY IS VALID
|
||||||
|
void checkText(char *text, inputFlags flags); //CHECKS IF TEXT IS VALID
|
||||||
int countIntLength(int number); //RETURNS LENGTH OF number
|
int countIntLength(int number); //RETURNS LENGTH OF number
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
outputFlags decryptText(char *text, char *keyNew, inputFlags flags)
|
outputFlags decryptText(char *text, char *keyNew, inputFlags flags)
|
||||||
{
|
{
|
||||||
|
//CHECK FOR INVALID text
|
||||||
|
checkText(text, flags);
|
||||||
|
|
||||||
//CHECK FOR INVALID key
|
//CHECK FOR INVALID key
|
||||||
checkKey(keyNew, flags);
|
checkKey(keyNew, flags);
|
||||||
|
|
||||||
|
@ -10,9 +10,18 @@
|
|||||||
|
|
||||||
outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
|
outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
|
||||||
{
|
{
|
||||||
|
//CHECK FOR INVALID text
|
||||||
|
checkText(text, flags);
|
||||||
|
|
||||||
//CHECK FOR ACTIVE VERSION
|
//CHECK FOR ACTIVE VERSION
|
||||||
if (!flags.skipCheck) checkVersion(flags);
|
if (!flags.skipCheck) checkVersion(flags);
|
||||||
|
|
||||||
|
if (strcmp(text, "") == 0)
|
||||||
|
{
|
||||||
|
if (!flags.noOutput) fprintf(stderr, "No text to encrypt!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//VARIABLES
|
//VARIABLES
|
||||||
char *key = malloc(getKeyLength());
|
char *key = malloc(getKeyLength());
|
||||||
char *returningText;
|
char *returningText;
|
||||||
|
@ -182,6 +182,15 @@ void checkKey(char *key, inputFlags flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkText(char *text, inputFlags flags)
|
||||||
|
{
|
||||||
|
if (strcmp(text, "") == 0)
|
||||||
|
{
|
||||||
|
if (!flags.noOutput) fprintf(stderr, "No text to encrypt!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int countIntLength(int number)
|
int countIntLength(int number)
|
||||||
{
|
{
|
||||||
int returning = 1;
|
int returning = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user