Release v4.13441 - midsummer
[RRG-proxmark3.git] / common / iso15693tools.c
blob494242135dfe20cb7865cb2194eba212eec7b71f
1 //-----------------------------------------------------------------------------
2 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 // at your option, any later version. See the LICENSE.txt file for the text of
4 // the license.
5 //-----------------------------------------------------------------------------
6 // ISO15693 other commons
7 //-----------------------------------------------------------------------------
8 #include "iso15693tools.h"
10 #include <stdio.h>
12 // returns a string representation of the UID
13 // UID is transmitted and stored LSB first, displayed MSB first
14 // dest char* buffer, where to put the UID, if NULL a static buffer is returned
15 // uid[] the UID in transmission order
16 // return: ptr to string
17 char *iso15693_sprintUID(char *dest, uint8_t *uid) {
18 static char tempbuf[3 * 8 + 1] = {0};
19 if (dest == NULL)
20 dest = tempbuf;
22 if (uid) {
23 sprintf(dest, "%02X %02X %02X %02X %02X %02X %02X %02X",
24 uid[7], uid[6], uid[5], uid[4],
25 uid[3], uid[2], uid[1], uid[0]
28 return dest;