0

I currently have a binary string that has been encoded with base64_encode(). However, I need to represent this string only with 0-9a-zA-Z characters.

I am currently wrapping the string in bin2hex() to represent it with 0-9a-f. However, for transport reasons, I would like to compress the string by representing it in base 36 instead of base 16.

My attempts at wrapping the bin2hex'ed string with base_convert($string, 16, 36) appears to work, until I attempt to decode it with base_convert($string, 36, 16), and it just results in all 0s. Why is that?

2
Contributors
1
Reply
16
Views
7 Months
Discussion Span
Last Post by rubberman
1

Have you tried to convert the hex string to bin (hex2bin()) and then to base-36? Or the binary string to base-36. In any case, it must be a pretty big number to need the base-36 conversion to compress it. Some more information, and the original binary or hex string would help to sort this out. We could try some different approaches to see what works best.

Final question, which version of PHP are you using? I know that with 5.4 I had to do a lot of bug fixing in a number of areas where it was just wrong in order to do my work with Nokia.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.