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.
精彩评论