View Single Post
Old 04-02-2009, 11:22 AM   #166
igorsk
Wizard
igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.igorsk ought to be getting tired of karma fortunes by now.
 
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
Quote:
Originally Posted by elinares View Post
I've tested both books with Calibre, it can not show or transform none of them. The unscrambling method described on sven.de/librie is exactly the same I implemented in LRFTools, but for some streams it does not work.

I'm going to pm you the books.
Thanks for the sample. I did a little debugging, and apparently the correct calculation looks like this:
Code:
uint8_t get_local_key(int streamlen, uint8_t key)
{
  if ( key && key <= 0xF0u )
    return streamlen % key + 0xF;
  else
    return 0;
}
Note the extra check and that only 8 bits of the key are used.
igorsk is offline   Reply With Quote