I have an NFC application built on android that sends a hash as an apdu answer. This is the code I use in my Android app to send the hash:
@Override
public byte[] processCommandApdu(byte[] arg0, Bundle arg1) {
String hash = "e68d3f574009cbbe011150263634c5c0";
return hash.getBytes(Charset.forName("UTF-8"));
}
Now when I receive it on the Arduino side of things I get this RAW data:
10154561005110253555248485799989810148494949534850255255255255255255255255255
How do I get the hash back from that?
This is what I have right now but it's obviously not working:
uint8_t response[32];
uint8_t responseLength = sizeof(response);
if (nfc.inDataExchange(message, sizeof(message), response, &responseLength)) {
Serial.print("RAW: ");
for (int i = 0; i < sizeof(response); i++) {
Serial.print(response[i]);
}
Serial.println(" ");
char buffer[32];
itoa((int)response,buffer,8);
Serial.print("ITOA: ");
for (int i = 0; i < sizeof(buffer); i++) {
Serial.print(buffer[i]);
}
Serial.println(" ");
}
And this is the serial output of the code above:
RAW: 10154561005110253555248485799989810148494949534850255255255255255255255255255
ITOA: 4253 µ +
3ü R
Halp!!!