Javascript String to Hex (and back again) Method