Unless you really, really have to have base62, why not go for:
base64_encode()
base64_decode()
The only other added characters are "+" and "=", and it's a very well-known method to pack and unpack binary strings with available functions in many other languages.