开发者

Compressing and Decompress in PHP and JS

I was wondering if someone has come up with something similar to this??

a way to compress a text:

<?php
    $str = 'Hello world!';// the text here can be any characters long
    $key = compress($str);// should return a key 32characters long/ or a fixed n开发者_开发百科umber of characters
    $value = decompress($key);// should return "Hello World!"
?>

Using MD5 is a one way encryption/compression, basically I would like something like MD5 to be reversable. Not necessarly the MD5 it self.


md5 is not a compression algorithm : it's a hashing algorithm.

If you want to compress/decompress, in PHP, you can use something like gzcompress, gzdeflate, bzcompress, ... depending on the compression algorithm you want to use, and the functions available on your server.

You can take a look at the Compression and Archive Extensions section of the manual, which lists the different extensions you might be able to use -- provided they're installed on your server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜