View Single Post
Old 03-13-2010, 06:13 AM   #2
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,001
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by pdurrant View Post
Now, the problem I'm having is that I can't find a way to determine if these multibyte flags are present in a Mobipocket file or not.
That wasn't my problem. My problem was that I didn't understand that although trailing data entries and multibyes do not get compressed, the trailing multibytes in a utf8 encoded file do get encrypted (although the other trailing data entries do not). So it's vital not to remove the count of trailing multibytes before trying to decrypt the file.

So it seems the test for whether the trailing data flags is valid is actually quote simple - version 5 or greater, and header length 0xE4 or greater. Although since I've never seen a version 5 Mobipocket file with a header length less than 0xE4, the latter condition might be redundant.

I've updated the wiki to clarify the situation for anyone else fool enough to poke about in Mobipocket file innards.
pdurrant is online now   Reply With Quote