Base conversion in PHP, Radix 255
Allows you to convert to any base between 2 and 255, effectively using all the ASCII characters.
In order to convert very large numbers with arbitrary precision you’ll need the BCMath lib. Without BCMath the large numbers will not be converted correctly due to PHP not being able to do the arithmetic.
If you need to convert between bases 2-36, you can use the base_convert() function. However, converting to higher bases such as 255 has some benefits, such as “compressing” the characters.
You can successfully compress SHA1 from a 40 byte hex to a 20 byte string.
echo base255(base_convert(sha1('test'), 16, 10)));
Since there is no loss of data, it can be used as a lossless compression. Normal compression such as zlib won’t work on a SHA1 since there are no repeating patterns.