hash_encode fixes, added base64encode, tests