@armor, given that the natural data format for 99.999% of computers in the world is binary, the most efficient space utilisation will be to not convert from binary to decimal.
7 bytes can be stored in uint64_t
uint64_t takes 8 bytes, so the effort of converting to decimal means that you are using one byte more.
uint32_t for the 4 byte UID conversion takes the same amount of space.
To display the UID, you could use something like the following to fill the string buffer with ASCII hexadecimal representation of the UID for the human (other methods can be envisaged of course):
sprintf(buf, "%02X%02X%02X%02X%02X%02X%02X", uid, uid, uid, uid, uid, uid, uid);
So, an 7 byte NFC tag UID of 0x044A7232214B80 would be displayed as 14 ASCII digits: “044A7232214B80”.
Re efficient searching, a simple iteration through the data will be really quick, so no need to worry about that as an issue.
Schemes can be envisage to handle the data structure of 4 byte vs 7 byte UID’s.
- store the UID’s in their raw binary form
- search by iterating the structure through memory
- convert to the binary to ASCII hexadecimal for the human
Hope this helps.