Encoding & deconding to uid