Base4 encode and decode