in reply to base64 and hex question

I would suspect that pack()/unpack(), or maybe printf()/sprintf() might be your friends for this application....