Calculate uid