Re: Decompress a zlib'd string in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I remove pack, I get the error:
gzuncompress(): data error

$uncompressed = gzuncompress($the_string);
echo $uncompressed;


in my hex editor, the movie header contains:
ftypqt   qt  PmoovHcmovdcomzlib4cmvd

From the Quicktime Docs, 'dcomzlib' is supposed to be the compression method for the below string:

fixúµRøo1ˆ](R•
uh·@A≤†∞ÅTïÜ©TQT1t1gÁŒäÌ;ùù+eÈ‘ˇѯòÏåå¸+·ŸÁ˚맆ƒK|ˆ{~˛figø°
...and so on


has anyone had experience with this ?
g

On Oct 26, 2005, at 12:15 PM, Jochem Maas wrote:

Graham Anderson wrote:

Just to show I am not a total leech, I did consult the manual before I posted the question :)


ack.


The compressor in the file data says: dcomzlib
I tried the below with gzinflate and with gzuncompress.
Both give errors:
 gzinflate(): data error
gzuncompress(): data error
The below is the copy/pasted hex of the compressed movie header in the Quicktime Movie File FYI ,I did not compress the string myself...it is compressed automatically when a Quicktime movie is exported. $compressed = "DE789CB552BF6F133114F65D2852A50A7568E14041B2A00B120CB081549514860CA9 545 15431743167E7CE8AED3B9D9D2B65E9D4FF0484F8079810EC8C0C8CFC2BE1D9E7FB91 A4A 008C44B7CF67B7EFEDE67BF0FA1B59F32CB4A849090654A61465F2FD21B762014BE72 234 0F6DFDA9CB3EC3F6D56F6FC92F520FEC1146402EB133371357B6DCD1AAD3D3B9BAD5E 37B 09F07CEDD61D46898FB4C68D39EF0B8EE6CB8262927B0C092FEE6EE080D613C4EA928 ECB E4C4561D81B43F2FC914309822FD120CF05C32F218C0F1800E2215154303810BC935C 8D2 171944857204A2050B19D39F3C4EE5BD0151FB62143810C115C0319B15991F9EEC90C 042 71A3F27A64306EDD08A4C9F166CDC29B16141FCFA9336AF05CC2FB4D1B493B3EF082E D09 ABB42659BB6BF16B372AF264CB1D23E318AB471FDA811EA5EF4A1523C1F6FC616ECBD F57 B7B6D2CCEDAFCF007CCBB7146D9C2E3DDD38CA80E96B5ED098862F1616F4DA9B10CAF 292 299EBE2C36A234CFE20D3D0E734323DFF3B99462223B4835567AF20DFE0FD8AF27DD2 956 FC929F38A0188E0F3CD4A31C710CE96F4FBCCEB77ABACF41B7474FB5F75F8CDEB70BC A0C 3E302501B1F7EB668E55E818780B60CFDA55DC6FA4071490CCF14BADCB0BBCABF6AF3 36B A549BBD6D98EF78795DB7F21A1D1DE27D124F92229BAAFA5E273EE3EE477D5A2068DE 01A 10C9F7293E2112FD9912109C38785058E72314D64567266D17653809256F81BB139CB 55A 6EC7A3D17E4CC01FF027425F9B1";
$string = pack("H*", $compressed);


ok I don't understand pack() very well at all, but why are you using it here? as far as I can tell gzinflate()/gzuncompress() don't work on binary
strings. what happens is you don't use pack()?


$uncompressed = gzinflate($string);
//$uncompressed = gzuncompress($string);
echo $uncompressed;
?>
On Oct 26, 2005, at 10:20 AM, Jochem Maas wrote:

Graham Anderson wrote:


How do you decompress a zlib'd string located in a file with  php ?
I need to dynamically write a password string into a movie file..... It appears that in QuickTime movie API, all sprite variables/ values are zlib'd inside the movie file
So I need to:
find the string
decompress a zlib'd string inside a file.
change its value => password=new_password
recompress the new value
write the zlib'd string back to the file
I'm sure if I can decompress the string, then it will not be too hard to do the rest :)



I'm sure if you spent 5 seconds searching the manual you would find this page:
http://php.net/manual/en/function.gzuncompress.php

and this one:

http://php.net/manual/en/function.gzcompress.php

(HINT: I typed http://php.net/zlib into the address bar to find them)


'the rest' involves find your substring's beginning and ending offset and then using those values to 'splice' the new substring (aka password) into the file/stream, I can visualize how ot do it but have never actually needed to do something like that ... I would say the compress/decompress is the easier part personally ...
buy hey as long as you get it working :-)




many thanks



back at ya, I learnt some stuff answering (hopefully) you question ;-)



g





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux