File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed
Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change 1010
1111#include " bpid.h"
1212#include " ../sha256/SHA256.h"
13+ #include " ../hex/hex.h"
1314
1415namespace arduino { namespace bpid {
1516
16- static String hexEncode (uint8_t * in, uint32_t size) {
17- String out;
18- out.reserve ((size * 2 ) + 1 );
19-
20- char *ptr = out.begin ();
21- for (uint32_t i = 0 ; i < size; i++) {
22- ptr += sprintf (ptr, " %02X" , in[i]);
23- }
24- return String (out.c_str ());
25- }
26-
2717 bool get (uint8_t * in, uint32_t size) {
2818 if (size < BOARD_PROVISIONING_ID_SIZE) {
2919 return false ;
@@ -50,7 +40,7 @@ namespace arduino { namespace bpid {
5040 }
5141 uint8_t out[SHA256::HASH_SIZE];
5242 arduino::sha256::oneshot (data, sizeof (data), out);
53- return hexEncode (out, sizeof (out));
43+ return arduino::hex::encode (out, sizeof (out));
5444 }
5545
5646}} // arduino::bpid
You can’t perform that action at this time.
0 commit comments