PPC issue


#1

I used some code from this forum to generate and decrypt serials with the BlowFish class, but it looks that this code has a little / big endian issue and does not work the right way on a PPC. I currently do not see any issue and do not have a PPC available for testing. Would be great to have some feedback where the issue could be. Here is the code:

    String decrypt(String str)
    {
        BlowFish bf(cryptokey, KeySize);
        int len = str.length();
        String plaintext = String::empty;
        for(int i = 0; i < len; i += 16)
        {
            String hex = str.substring(i, i+8);
            uint32 l = hex.getHexValue32();
            hex = str.substring(i+8, i+16);
            uint32 r = hex.getHexValue32();
            bf.decrypt(l, r);
            //concatenate, but ignore 0s (which may arise because we padded everything to 8 bytes
            if(l != 0)
                plaintext += String::createStringFromData(&l, 4);
            if(r != 0)
                plaintext += String::createStringFromData(&r, 4);
        }
        // adjust plain text by removing appended 'ev' or 'o'
        len = plaintext.length();
        if(plaintext[len-1] == 'o')
            plaintext = plaintext.substring(0, len-1);
        else
            plaintext = plaintext.substring(0, len-2);
        return plaintext;
    }

#2

Well, yes - the bit where it casts an int to a pointer to call createStringFromData is totally broken.


#3

Your right. I got the logs from the user now. Its definitively this function that fails… i will have a look at it.