]> foleosoft.com Git - QAnsel.git/commitdiff
Thu Aug 15 08:14:17 PM EDT 2024
authormiha-q <>
Fri, 16 Aug 2024 00:14:17 +0000 (20:14 -0400)
committermiha-q <>
Fri, 16 Aug 2024 00:14:17 +0000 (20:14 -0400)
src/hardware.c

index 9411c12216506685ac807496c3a3662eafb3e2ca..a2ef3289cdfe877fd7799c7d8baf3e6f01f0e317 100644 (file)
@@ -135,10 +135,10 @@ void qansel_quantis_chunk(unsigned char** chunk)
     FILE* f = fopen("/dev/qrandom0", "r");
     unsigned char c = fgetc(f);
     while (c == 0x00) c = fgetc(f);
-    (*chunk)[0] = c & rand();
+    (*chunk)[0] = c & (unsigned char)((rand() & 0xFF));
     for (int i = 0; i < QANSEL_QUANTIS_CHUNK_SIZE - 1; i++)
     {
-        (*chunk)[i + 1] = fgetc(f) & rand();
+        (*chunk)[i + 1] = fgetc(f) & (unsigned char)((rand() & 0xFF));
     }
     fclose(f);
 }
\ No newline at end of file