Created
November 2, 2019 00:42
-
-
Save Francesco149/00427ae6e4f3b77970c39788b5f49e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int file_xRead(sqlite3_file *file,byte *dst,int iAmt,int64_t iOfst) | |
{ | |
uint highbits; | |
uint bit33to32_or_shiftright1; | |
ulonglong tmpoff; | |
int xReadResult; | |
int random1; | |
int random3; | |
int random_multiplier; | |
klbvfs_file *klbfile; | |
int random2; | |
int rand_seed; | |
int random4; | |
int key1; | |
xReadResult = (**(code **)(*(int *)((int)&file->pMethods + g_defaultSzOsFile) + 8)) | |
(file,dst,iAmt,iOfst); | |
if (xReadResult == 0) { | |
random2 = 0x343fd; | |
random1 = 0x269ec3; | |
klbfile = (klbvfs_file *)((int)&file->pMethods + g_defaultSzOsFile); | |
key1 = klbfile->key1; | |
/* checks if iOfst is zero? */ | |
if ((int)(iOfst._4_4_ - (uint)((int)iOfst == 0)) < 0) { | |
random1 = 0; | |
random2 = klbfile->key2; | |
random_multiplier = klbfile->key3; | |
rand_seed = 1; | |
} | |
else { | |
random_multiplier = 1; | |
rand_seed = 0; | |
tmpoff = iOfst; | |
do { | |
if ((tmpoff & 1) != 0) { | |
rand_seed = random_multiplier * random1 + rand_seed; | |
random_multiplier = random_multiplier * random2; | |
} | |
highbits = (uint)(tmpoff >> 0x21); | |
bit33to32_or_shiftright1 = (uint)((byte)(tmpoff >> 0x20) & 1) << 0x1f | (uint)tmpoff >> 1; | |
tmpoff = CONCAT44(highbits,bit33to32_or_shiftright1); | |
random1 = random2 * random1 + random1; | |
random2 = random2 * random2; | |
} while ((bit33to32_or_shiftright1 | highbits) != 0); | |
random1 = 1; | |
random3 = 0x269ec3; | |
key1 = random_multiplier * key1 + rand_seed; | |
random2 = 0; | |
rand_seed = 0x343fd; | |
tmpoff = iOfst; | |
do { | |
if ((tmpoff & 1) != 0) { | |
random2 = random1 * random3 + random2; | |
random1 = random1 * rand_seed; | |
} | |
highbits = (uint)(tmpoff >> 0x21); | |
bit33to32_or_shiftright1 = (uint)((byte)(tmpoff >> 0x20) & 1) << 0x1f | (uint)tmpoff >> 1; | |
tmpoff = CONCAT44(highbits,bit33to32_or_shiftright1); | |
random3 = rand_seed * random3 + random3; | |
rand_seed = rand_seed * rand_seed; | |
} while ((bit33to32_or_shiftright1 | highbits) != 0); | |
random2 = random1 * klbfile->key2 + random2; | |
random_multiplier = klbfile->key3; | |
rand_seed = 1; | |
random1 = 0; | |
random3 = 0x269ec3; | |
random4 = 0x343fd; | |
do { | |
if ((iOfst & 1U) != 0) { | |
random1 = rand_seed * random3 + random1; | |
rand_seed = rand_seed * random4; | |
} | |
highbits = (uint)((ulonglong)iOfst >> 0x21); | |
bit33to32_or_shiftright1 = | |
(uint)((byte)((ulonglong)iOfst >> 0x20) & 1) << 0x1f | (uint)iOfst >> 1; | |
iOfst = CONCAT44(highbits,bit33to32_or_shiftright1); | |
random3 = random4 * random3 + random3; | |
random4 = random4 * random4; | |
} while ((bit33to32_or_shiftright1 | highbits) != 0); | |
} | |
if (0 < iAmt) { | |
random1 = rand_seed * random_multiplier + random1; | |
do { | |
highbits = (uint)key1 >> 0x18; | |
key1 = key1 * 0x343fd + 0x269ec3; | |
iAmt = iAmt + -1; | |
*dst = *dst ^ (byte)((uint)random2 >> 0x18) ^ (byte)highbits ^ (byte)((uint)random1 >> 0x18) | |
; | |
random1 = random1 * 0x343fd + 0x269ec3; | |
random2 = random2 * 0x343fd + 0x269ec3; | |
dst = dst + 1; | |
} while (iAmt != 0); | |
} | |
} | |
return xReadResult; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment