made using key in encrypter smarter

This commit is contained in:
Václav Šmejkal 2022-12-09 18:52:42 +01:00
parent 201211010a
commit e2982471f4
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19

View File

@ -49,7 +49,7 @@ outputFlags encryptText(char *text, char *keyNew)
} }
//VARIABLES //VARIABLES
char *key = malloc(getKeyLength() + 1); char *key = NULL;
char *returningText; char *returningText;
char *textBuffer = malloc(1); char *textBuffer = malloc(1);
int *textKeyChain = malloc(sizeof(int) * strlen(text)); int *textKeyChain = malloc(sizeof(int) * strlen(text));
@ -63,12 +63,14 @@ outputFlags encryptText(char *text, char *keyNew)
return noOutput(checkExitCode); return noOutput(checkExitCode);
} }
strcpy(key, keyNew); key = strdup(keyNew);
//REDEFINE keyLength //REDEFINE keyLength
setKeyLength(strlen(key)); setKeyLength(strlen(key));
} else //LOAD KEY } else //LOAD KEY
{ {
key = malloc(getKeyLength() + 1);
generateKey(key, getKeyLength()); generateKey(key, getKeyLength());
} }