unfucked generating random seed

This commit is contained in:
Václav Šmejkal 2022-12-09 17:55:21 +01:00
parent 799fc752b2
commit 80dd838ca8
No known key found for this signature in database
GPG Key ID: FD749A97DF2D5E19

View File

@ -59,8 +59,8 @@ outputFlags encryptText(char *text, char *keyNew)
//TRY TO MAKE RANDOM GENERATION REALLY "RANDOM" //TRY TO MAKE RANDOM GENERATION REALLY "RANDOM"
fileBuffer = fopen("/dev/urandom", "r"); fileBuffer = fopen("/dev/urandom", "r");
(void) (fread(&numberBuffer, sizeof(numberBuffer), 1, fileBuffer) + 1); //TODO: Try to create some function for processing exit value (void) (fread(&numberBuffer, sizeof(numberBuffer), 1, fileBuffer) + 1); //TODO: Try to create some function for processing exit value
srand(numberBuffer);
numberBuffer = abs(numberBuffer); //MAKE numberBuffer POSITIVE numberBuffer = abs(numberBuffer); //MAKE numberBuffer POSITIVE
srand(numberBuffer);
if (keyNew != NULL) if (keyNew != NULL)
{ {