ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sun May 19, 2019 9:23 am

All times are UTC




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
 Post subject: xoring speed
PostPosted: Sat Mar 30, 2019 9:00 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 227
what is the fastest way to implement this in quickbms.
void DLL_EXPORT do_decrypt(char* data_r,int len_r,int seek)
{
char* data = &data_r[seek];
int len = len_r - seek;

for(int i=0;i<len;i++)
{
char simu = data[i];
char toXo = key[i%0x180];

if(simu!=0&&simu!=toXo)
data[i] = simu^toXo;
}
}

mainly the
if(simu!=0&&simu!=toXo)
data[i] = simu^toXo;
part


Top
   
 Post subject: Re: xoring speed
PostPosted: Sat Mar 30, 2019 10:05 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10231
It's a conditional xor, better to use the function as-is:
Code:
set MEMORY_FILE10 string "
void do_decrypt(char *key, char* data,int len)
{
    for(int i=0;i<len;i++)
    {
        char simu = data[i];
        char toXo = key[i%0x180];

        if(simu!=0&&simu!=toXo)
            data[i] = simu^toXo;
    }
}
"

set KEY binary "..."
encryption calldll "MEMORY_FILE10 do_decrypt tcc RET KEY #INPUT# #INPUT_SIZE#"

log "dump.dat" OFFSET SIZE


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 2 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited