我有一个基于 android 的 NFC 应用程序,它发送一个哈希作为 apdu 答案。这是我在我的 Android 应用程序中用于发送哈希的代码:
@Override
public byte[] processCommandApdu(byte[] arg0, Bundle arg1) {
String hash = "e68d3f574009cbbe011150263634c5c0";
return hash.getBytes(Charset.forName("UTF-8"));
}
现在,当我在 Arduino 方面收到它时,我得到了以下 RAW 数据:
10154561005110253555248485799989810148494949534850255255255255255255255255255
我如何从中取回哈希?
这就是我现在所拥有的,但它显然不起作用:
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(" ");
}
这是上面代码的串行输出:
RAW: 10154561005110253555248485799989810148494949534850255255255255255255255255255
ITOA: 4253 µ +
3ü R
哈!!!!