View Single Post
Old 04-03-2009, 10:24 AM   #167
elinares
Xtreme Quijote
elinares doesn't litterelinares doesn't litterelinares doesn't litter
 
elinares's Avatar
 
Posts: 101
Karma: 208
Join Date: Sep 2008
Location: La Mancha, Spain
Device: Sony PRS-505
Quote:
Originally Posted by igorsk View Post
Thanks for the sample. I did a little debugging, and apparently the correct calculation looks like this:
Hi igorsk,
I've testing the algorithm and this is working right now for me:
Code:
        BYTE keybyte;

        declen = LengthOfStream
        keybyte = (declen % (PsuedoEncryptionKeyByte&0xFF)) + 0x0F; 
        if ((type == 0x11)||(type == 0x19)||(type == 0x17))
        {
            if (declen > 0x400) declen = 0x400;
        }       
        for (i = 0; i < declen; i++) {
            *(p + i) ^= keybyte;
        }
For both books (Ed Lacy) PseudoEncriptionKeyByte = -480 (int);
but -480&0xFF = 32, that`s the correct module for declen.
elinares is offline   Reply With Quote