Use mt19937_xorcode helper function

This commit is contained in:
kichikuou
2023-12-17 09:01:28 +09:00
parent 05d2ad8600
commit c3f39aeb96
4 changed files with 4 additions and 13 deletions
+1 -4
View File
@@ -274,10 +274,7 @@ static int DataFile_Open(int link)
uint8_t *compressed_data = xmalloc(compressed_size);
buffer_read_bytes(&r, compressed_data, compressed_size);
archive_free_data(dfile);
struct mt19937 mt;
mt19937_init(&mt, 4588163);
for (size_t i = 0; i < compressed_size; i++)
compressed_data[i] ^= mt19937_genrand(&mt);
mt19937_xorcode(compressed_data, compressed_size, 4588163);
uint8_t *raw = xmalloc(uncompressed_size);
int rv = uncompress(raw, &uncompressed_size, compressed_data, compressed_size);