For advanced programmers (HELP)

Douglas Farias

Expert
Licensed User
Longtime User
hi all, i need to open/edit a .dat file, this is encrypted (ps.dat)
for decrypt this file i need this code

B4X:
const unsigned char key[0x32] ={
    0x3B, 0x21, 0x6B, 0x2E, 0x61, 0x7A, 0x22, 0x4D, 0x41, 0x45, 0x6A, 0x68, 0x67, 0x61, 0x73, 0x62,
    0x75, 0x62, 0x65, 0x31, 0x38, 0x33, 0x34, 0x30, 0x2D, 0x66, 0x5A, 0x2C, 0x3B, 0x61, 0x73, 0x41,
    0x4F, 0x4A, 0x4D, 0x2E, 0x6A, 0x6F, 0x71, 0x77, 0x41, 0x73, 0x65, 0x66, 0x46, 0x73, 0x46, 0x6A,
    0x64, 0x00

};

const unsigned char* Getkey(int &pKeyLen){
    pKeyLen = 0x31;
    return key;
}
void DecriptBinary_lod(unsigned char* output, int keylen,const unsigned char* input ,int length){
    const unsigned char* key = Getkey(keylen);
    if (length  == 0){
        return NULL;
    }
    int randomlen =  length;
    for(int i = 0; i < length; i++){
        int bKey = key[(randomlen) % keylen];
        int bData = input[i];
        bKey = (bKey ^ bData) << 0x10;
        int bResult = (length -i)& 0x80000007;
        if(! bResult){
            bResult--;
            bResult = bResult | 0xFFFFFFF8;
            bResult++;
        }
        bKey = bKey << (unsigned char)7 - bResult;
        int  reusult  = bKey;
        bKey = bKey >> 0x10;
        reusult = reusult >> 0x18;
        output[i] = (unsigned char)(reusult | bKey);
        randomlen += 0x17;
    }
}
i have put the file attached on the post
ps.dat = encrypt
ps.txt = decrypt

how can i open this file on B4J? i need to decrypt - open - edit some lines - and encrypt again back
how is this code on b4a? this code is c++ or c# i really dont know


here is the ps.dat decrypt
 

Attachments

  • pega.zip
    20.4 KB · Views: 273