R&Y: Added DAY RTA Tapp Card and Additional BKK BEM Stored Value Card AIDs to `aid_de...
[RRG-proxmark3.git] / common / iso15693tools.c
blob9c554fd701378ce0c02f5d6e55ea343d5b0f111f
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // ISO15693 other commons
17 //-----------------------------------------------------------------------------
18 #include "iso15693tools.h"
19 #include <stdio.h>
21 #define ISO15693_SPRINTUID_BUFLEN (3 * 8 + 1)
23 // returns a string representation of the UID
24 // UID is transmitted and stored LSB first, displayed MSB first
25 // dest char* buffer, where to put the UID, if NULL a static buffer is returned
26 // uid[] the UID in transmission order
27 // return: ptr to string
28 char *iso15693_sprintUID(char *dest, uint8_t *uid) {
29 static char tmp[ISO15693_SPRINTUID_BUFLEN] = {0};
30 if (dest == NULL) {
31 dest = tmp;
34 if (uid) {
35 #ifdef HAVE_SNPRINTF
36 snprintf(dest, ISO15693_SPRINTUID_BUFLEN,
37 #else
38 sprintf(dest,
39 #endif
40 "%02X %02X %02X %02X %02X %02X %02X %02X",
41 uid[7], uid[6], uid[5], uid[4],
42 uid[3], uid[2], uid[1], uid[0]
45 return dest;