I have a big text:
$s = "Bangladesh is a country located in South Asia, bordered by India to the west, north, and east, Myanmar (Burma) to the southeast, and the Bay of Bengal to the south. It is the eighth-most populous country in the world, with a population exceeding 160 million people.";
I want to compress the text in 256 bit or less. I can use
$array = str_split($s);
$hash='';
foreach($array as $char){
$hash= $hash.sprintf('%08b', ord($char));
}
Problem is it is very large than 256 bit.
Also, there is built in function.
$hash = hash('sha256', $s);
Problem is $hash can not be converted to original data.
So, is there any way that will compress string to 256 bit data which can be converted to original string also?