Max,

not sure if this helps but it's worth a try.

I was trying to uncompress files from zip archives a while ago. The most common compression method used in zip is deflate (as you already know) so theroretically it shouldn't be a problem to uncompress() files in a zip, BUT.. the thing is, although both Flash and the common 3rd party zip tools use the same compression method, they use different checksums.

Zlib (Flash) uses an ADLER32 checksum, see RFC 1950 [1], whereas zip uses CRC-32 [2]. The checksum is calculated over the uncompressed file so imho it's impossible to uncompress a file in a 3rd party created zip archive (you don't have the ADLER32 checksum that Flash needs - the dog bites its tail there), which really is a pity.

Please let me know if you find a way around that, i'd be very interested. I'll do the same. Maybe we should joint our efforts there.

Cheers,
Claus.

[1] http://www.gzip.org/zlib/rfc-zlib.html
[2] http://tinyurl.com/an7mj


Max wrote:

Shouldn't there be more interest in this? Flash's compress() and
uncompress() features use DEFLATE, which is the same algorithim used
in zip files and png images. Imagine compressing XML files to a tiny
fraction of their original size and decompressing them within flash!
The uses are endless, especially when you start to think about
compressing files within flash and sending them other places.

My progress in this has stalled. I'm pretty confident now the last two
bits in a ByteStream compressed with compress() are a checksum, and
I'm almost completely sure it's a crc-16 checksum (although it's
always off by one, I can't say I know why).

Gzip actually includes a checksum, but it's crc-32, not crc-16. It's
not as if you can know what the crc-16 checksum is without
decompressing the file first. So basically, flash needs the checksum
before it will decompress the binary data, and you don't have it with
a normal gzip file. Now I'm starting to think gzip is a dead end and a
custom format would probably be more useful.

Anyway, making a custom format is out of my league it seems. I tried
working something out with Python but I can't pull it off. Surely the
throngs of people interested in this would figure something out,
unless I'm alone...
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to